logo

Crowdly

Browser

Додати до Chrome

Se considera crearea unei liste dinamice ordonata function nod(x){ this.comt...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Se considera crearea unei liste dinamice ordonata

function nod(x){

this.comtor=1;

this.x=x;

this.urmator=null;

}

function inserare(){

x=eval(prompt("val x",""));

fanion.x=x;

q1=inceput;

q2=inceput.urmator;

while(q2.x<x){

q1=q2;

q2=q1.urmator;

}

if((q2.x==x) && (q2!=fanion))

q2.contor++;

else {

p=new nod(x);

q1.urmator=p;

p.urmator=q2;

}

}

function afisare(){

s=""; q=inceput.urmator;

while(q!=fanion){

s+="q.x="+q.x+"<br>";

q=q.urmator;

}

document.write("Lista: <br>"+s);

}

inceput=new nod(0); fanion=new nod(0); inceput.urmator=fanion;

c=eval(prompt("1-inserare, 2-afisare",""));

while(c==1 || c==2){

if(c==1)

inserare();

else

afisare();

c=eval(prompt("1-inserare, 2-afisare",""));

}

Faceti asocierile (Inserarea unui nod nou):

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на elearning.e-uvt.ro?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome