1 / 3

Stergerea unui nod intr -o lista simplu inlantuita

Stergerea unui nod intr -o lista simplu inlantuita.

rowdy
Download Presentation

Stergerea unui nod intr -o lista simplu inlantuita

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 intr-o listasimpluinlantuita Putemsterge un nod de la inceputullistei, de la sfarsitulei, sau din interior. Pentru a sterge un nod, se retineacestaintr-o variabilaauxiliara, se sterglegaturiledintre el silistaapoi se elibereazaspatiul de memorieocupat de variabilaauxiliara (adica de nodul care trebuiesters).

  2. Stergereauneivalori date x p p aux Void stergere(int x) {p=prim; If(prim->info==x) {aux=prim; Prim=prim->urm; Delete aux;} Else {p=prim; while(p->urm->info!=x && p->urm) p=p->urm; Aux=p->urm; P->urm=auz->urm; Delete aux;} } x

  3. Stergereaunui nod de pepozitia k p p aux • Void stergere (int k) • {nod *aux, *p; • If(k==1) • {aux=prim; • Prim=prim->urm; • Delete aux;} Else {p=prim; For(i=0;i<k;i++) p=p->urm; aux=p->urm; P->urm=aux->urm; Detele aux;} } k

More Related