1 / 4

Stergerea unui nod din lista :

Stergerea unui nod din lista :. 1.Cu o valoare data x 2. De pe pozitia k. Stergerea unui nod cu valoare data “x”. Algoritmul : void stergere ( int x) { nod *aux; if(prim->info==x) { aux=prim; prim=aux-> u rm ; delete aux; } else{p=prim;

aderyn
Download Presentation

Stergerea unui nod din lista :

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Stergereaunui nod din lista: 1.Cu o valoare data x 2. De pepozitiak

  2. Stergereaunui nod cu valoare data “x” Algoritmul: void stergere(int x) { nod *aux; if(prim->info==x) { aux=prim; prim=aux->urm; delete aux; } else{p=prim; while(p->urm!=x && p->urm) p=p->urm; aux=p->urm; p->urm=aux->urm; delete aux;

  3. Stergereraunui element de pepozitia “k” Algoritmul: intc=0; void stergere(int k) { nod *aux; if(k) { while(c<k) { c++; p=p->urm; } aux=p->urm; p->urm=aux->urm; delete aux; } else { aux=prim->urm; delete prim; prim=aux; }

  4. Simulareastergerii A unuinod cu valoare data x Ex: x=3; 2 3 1 6 p aux

More Related