Lista Duplamente Encandeada New(p);
description
Transcript of Lista Duplamente Encandeada New(p);
P
Lista Duplamente Encandeada
New(p);
0
AA
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO QUANDO LISTA VAZIA
P
Lista Duplamente Encandeada
New(p);P^.prox := nil;
0 Pr
ox=N
IL
AA
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO QUANDO LISTA VAZIA
P
Lista Duplamente Encandeada
New(p);P^.prox := nil;P^.ant := nil;
0 Prox
=NIL
AA
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO QUANDO LISTA VAZIA
Ant=
NIL
P
Lista Duplamente Encandeada
New(p);P^.prox := nil;P^.ant := nil;L := P;
0 Pr
ox=N
IL
AA
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO QUANDO LISTA VAZIA
Ant=
NIL
LAA
P
Lista Duplamente Encandeada
New(p);P^.prox := nil;P^.ant := nil;L := P;F := P;
001 Jose0 R$ 1500,00 Pr
ox=N
IL
AA
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO QUANDO LISTA VAZIA
Ant=
NIL
FAAL
AA
P
Lista Duplamente Encandeada
New(f^.prox);
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO SEQUENCIAL NO FINAL DA LISTA
Ant=
NIL
LAA
FAA
BB
P
Lista Duplamente Encandeada
New(f^.prox);P:= f^.prox;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
BB
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO SEQUENCIAL NO FINAL DA LISTA
Ant=
NIL
LAA
FAA
BB
P
Lista Duplamente Encandeada
New(f^.prox);P:= f^.prox;p^.ant :=F
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
BB
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO SEQUENCIAL NO FINAL DA LISTA
Ant=
NIL
LAA
FAA
BB
Ant A
A
P
Lista Duplamente Encandeada
New(f^.prox);P:= f^.prox;p^.ant :=F;F := P;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
BB
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO SEQUENCIAL NO FINAL DA LISTA
Ant=
NIL
LAA
FBB
BB
Ant A
A
P
Lista Duplamente Encandeada
New(f^.prox);P:= f^.prox;p^.ant :=F;F := P;P^.prox := nil;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
BB
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO SEQUENCIAL NO FINAL DA LISTA
Ant=
NIL
LAA
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
A
Lista Duplamente Encandeada
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO INICIO DA LISTA
Ant=
NIL
LAA
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
A
Lista Duplamente Encandeada
New(P);
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO INICIO DA LISTA
Ant=
NIL
LAA
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
AP
0 Pr
ox=N
IL
CC
CC
Lista Duplamente Encandeada
New(P);P^.prox := L;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO INICIO DA LISTA
Ant=
NIL
LAA
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
AP
0 Pr
ox=A
A
CC
CC
Lista Duplamente Encandeada
New(P);P^.prox := L;P^.ant := nil;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO INICIO DA LISTA
Ant=
NIL
LAA
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
AP
0 Pr
ox=A
A
CC
CC
Ant=
NIL
Lista Duplamente Encandeada
New(P);P^.prox := L;P^.ant := nil;L^.ant : P;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO INICIO DA LISTA
Ant=
CC
LAA
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
AP
0 Pr
ox=A
A
CC
CC
Ant=
NIL
Lista Duplamente Encandeada
New(P);P^.prox := L;P^.ant := nil;L^.ant : P;L := P;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO INICIO DA LISTA
Ant=
CC
LCC
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
AP
0 Pr
ox=A
A
CC
CC
Ant =
NIL
Lista Duplamente Encandeada
New(P);P^.prox := L;P^.ant := nil;L^.ant : P;L := P;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – INCLUSÃO INICIO DA LISTA
Ant=
CC
LCC
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
A
P
003 Carlos0 R$ 780,00 Pr
ox=A
A
CC
CC
Ant=
NIL
Lista Duplamente Encandeada 001
Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO FINAL DA LISTA
Ant=
CC
LCC
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
A 003 Carlos0 R$ 780,00 Pr
ox=A
A
CC
Ant=
NIL
Lista Duplamente Encandeada
P := F^.ant;
001 Jose0 R$ 1500,00 Pr
ox=B
B
AA
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO FINAL DA LISTA
Ant=
CC
LCC
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
A 003 Carlos0 R$ 780,00 Pr
ox=A
A
CC
Ant=
NIL
PAA
Lista Duplamente Encandeada
P := F^.ant;P^.prox := NIL;
001 Jose0 R$ 1500,00 Pr
ox=N
IL
AA
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO FINAL DA LISTA
Ant=
CC
LCC
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
A 003 Carlos0 R$ 780,00 Pr
ox=A
A
CC
Ant=
NIL
PAA
Lista Duplamente Encandeada
P := F^.ant;P^.prox := NIL;Dispose(F);
001 Jose0 R$ 1500,00 Pr
ox=N
IL
AA
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO FINAL DA LISTA
Ant=
CC
LCC
FBB
002 Antonio R$ 1000,00 Pr
ox=N
IL
BB
Ant A
A 003 Carlos0 R$ 780,00 Pr
ox=A
A
CC
Ant=
NIL
PAA
Lista Duplamente Encandeada
P := F^.ant;P^.prox := NIL;Dispose(F);F:= P;
001 Jose0 R$ 1500,00 Pr
ox=N
IL
AA
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO FINAL DA LISTA
Ant=
CC
LCC
FBB
003 Carlos0 R$ 780,00 Pr
ox=A
A
CC
Ant=
NIL
PAA
Lista Duplamente Encandeada
001 Jose0 R$ 1500,00 Pr
ox=N
IL
AA
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO NO INICIO/FINAL QUANDO LISTA TEM SOMENTE UM ELEMENTO
Ant=
NIL
FAAL
AA
Lista Duplamente Encandeada
Dispose(F); 001 Jose0 R$ 1500,00 Pr
ox=N
IL
AA
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO NO INICIO/FINAL QUANDO LISTA TEM SOMENTE UM ELEMENTO
Ant=
NIL
FAAL
AA
Lista Duplamente Encandeada
Dispose(F);
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO NO INICIO/FINAL QUANDO LISTA TEM SOMENTE UM ELEMENTO
FAAL
AA
Lista Duplamente Encandeada
Dispose(F);L :=NIL;F := NIL;
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO NO INICIO/FINAL QUANDO LISTA TEM SOMENTE UM ELEMENTO
FAAL
AA
002 Antonio R$ 1000,00 Pr
ox=C
C
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant C
C 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL 003
Carlos0 R$ 1800,00 Pr
ox=D
D
CC
Ant=
BB
Digite a Posição da Lista.: 3
R:= L;P:= L^.PROX;Cont := 1;While (cont < posi-1) doBegin r:= r^.prox; p := p^.prox; cont := cont + 1;End;
002 Antonio R$ 1000,00 Pr
ox=C
C
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant C
C 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL 003
Carlos0 R$ 1800,00 Pr
ox=D
D
CC
Ant=
BB
Digite a Posição da Lista.: 3
RAA
pBB
R:= L;P:= L^.PROX;Cont := 1;While (cont < posi-1) doBegin r:= r^.prox; p := p^.prox; cont := cont + 1;End;
R:= L;P:= L^.PROX;Cont := 1;While (cont < posi-1) doBegin r:= r^.prox; p := p^.prox; cont := cont + 1;End;
002 Antonio R$ 1000,00 Pr
ox=C
C
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant C
C 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL 003
Carlos0 R$ 1800,00 Pr
ox=D
D
CC
Ant=
BB
Digite a Posição da Lista.: 3
RAA
pBB
R:= L;P:= L^.PROX;Cont := 1;While (cont < posi-1) doBegin r:= r^.prox; p := p^.prox; cont := cont + 1;End;X := p^.prox;
002 Antonio R$ 1000,00 Pr
ox=C
C
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant C
C 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL 003
Carlos0 R$ 1800,00 Pr
ox=D
D
CC
Ant=
BB
Digite a Posição da Lista.: 3
RBB
pCC
XDD
R:= L;P:= L^.PROX;Cont := 1;While (cont < posi-1) doBegin r:= r^.prox; p := p^.prox; cont := cont + 1;End;X := p^.prox;X^.ant := R;
002 Antonio R$ 1000,00 Pr
ox=C
C
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant B
B 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL 003
Carlos0 R$ 1800,00 Pr
ox=D
D
CC
Ant=
BB
Digite a Posição da Lista.: 3
RBB
pCC
XDD
R:= L;P:= L^.PROX;Cont := 1;While (cont < posi-1) doBegin r:= r^.prox; p := p^.prox; cont := cont + 1;End;X := p^.prox;X^.ant := R;R ^.prox := X;
002 Antonio R$ 1000,00 Pr
ox=D
D
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant B
B 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL 003
Carlos0 R$ 1800,00 Pr
ox=D
D
CC
Ant=
BB
Digite a Posição da Lista.: 3
RBB
pCC
XDD
R:= L;P:= L^.PROX;Cont := 1;While (cont < posi-1) doBegin r:= r^.prox; p := p^.prox; cont := cont + 1;End;X := p^.prox;X^.ant := R;R ^.prox := X;Dipose(p);
002 Antonio R$ 1000,00 Pr
ox=D
D
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant B
B 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL 003
Carlos0 R$ 1800,00 Pr
ox=D
D
CC
Ant=
BB
Digite a Posição da Lista.: 3
RBB
pCC
XDD
002 Antonio R$ 1000,00 Pr
ox=D
D
BB
LISTA DUPLAMENTE ENCADEADA – EXCLUSAO EM UMA POSICAO
Ant=
AA
LCC
FBB
004 Judite R$ 1000,00 Pr
ox=N
IL
DD
Ant B
B 001 Jose0 R$ 1500,00 Pr
ox=A
A
AA
Ant=
NIL
REGISTRO EXCLUIDO