logo

Crowdly

Browser

Add to Chrome

Se considera crearea unei liste dinamice, folosind metoda problemei concordantei...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Se considera crearea unei liste dinamice, folosind metoda

problemei concordantei

function nod(cuvant){

    this.contor=1;    this.cuvant=cuvant;    this.urmator=null;}

function inserare(){    let x=prompt("Introduceti cuvant","");    let p=inceput;b=true;    while((p!=null) && (b==true)){        if(x==p.cuvant)            b=false;        else            p=p.urmator;    }    if(p==null){        p=new nod(x);        p.urmator=inceput;        inceput=p;    }    else        p.contor++;}

function afisare(){    let q=inceput;    while(q!=null){        console.log(q.cuvant, q.contor);        q=q.urmator;    }    }let inceput=null;let c=Number(prompt("1-inserare, 2-afisare"));while(c==1 || c==2){    if(c==1)        inserare();    else        afisare();c=Number(prompt("1-inserare, 2-afisare"));  }

Faceti asocierile (structura nodurilor):

More questions like this

Want instant access to all verified answers on elearning.e-uvt.ro?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome