1 / 3

Listas duplamente encadeadas

Listas duplamente encadeadas. Estrutura: tDado = integer; { ou real, char, etc.} tPtNo = ^tNo; tNo = record Ant: tPtNo Dado: tDado; Prox: tPtNo; end; var p,q: tPtNo ;. p. . /. /. procedure InsereNoFinal(var p:tPtNo; V: tDado);

wan
Télécharger la présentation

Listas duplamente encadeadas

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. Listas duplamente encadeadas Estrutura: tDado = integer; { ou real, char, etc.} tPtNo = ^tNo; tNo = record Ant: tPtNo Dado: tDado; Prox: tPtNo; end; var p,q: tPtNo; p ... / /

  2. procedure InsereNoFinal(var p:tPtNo; V: tDado); var q,r: tPtNo; begin new(r); r^.Dado:=V; r^.Prox:=nil; if p = nil then p:= r else begin q:= p; while q^.Prox <> nil do q:=q^.Prox; q^.Prox:=r; end; end; Inserção de um nó em uma lista encadeada

  3. procedure InsereNoFinal(var p:tPtNo; V: tDado); var q,r: tPtNo; begin new(r); r^.Dado:=V; r^.Prox:=nil; if p = nil then begin p:= r; r^.Ant:= nil; end; else begin q:= p; while q^.Prox <> nil do q:=q^.Prox; q^.Prox:=r; r^.Ant := q; end; end; Inserção de um nó em uma lista duplamente encadeada

More Related