







Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!








Lista Estatica Con Corrimiento Lista Estatica Sin Corrimiento Lista Dinamica Simple Enlace Lineal Lista Dinamica Simple Enlace Circular LECC.PAS LESC.PAS LDSEL.PAS LDSEC.PAS
Const Const MAXLISTA = 50; MAXLISTA = 50; Type Type Type Type TClave = Integer; TClave = Integer; TClave = Integer; TClave = Integer;
TDato = Record TDato = Record TDato = Record TDato = Record Clave:TClave; Clave:TClave; Clave:TClave; Clave:TClave; Otros: integer; Otros: integer; Otros: integer; Otros: integer; End; End; End; End; TLista = Record TElem=Record Tpuntero = ^Nodo Tpuntero = ^Nodo Elem: array[1..MAXLISTA] of TDato; Info:TDato; Actual: 1.. MAXLISTA +1; Sig:0..MAXLISTA; Nodo = Record Nodo = Record Tope: 0..MAXLISTA; End; Info:Tdato; Info:Tdato; End; Sig:TPuntero; Sig:TPuntero; TLista=Record End; End; Elem:array[1..MAXLISTA] of TElem; Actual:0..MAXLISTA; POcup:0..MAXLISTA; TLista=Record TLista=Record PLibre:0..MAXLISTA; Cab:TPuntero; Cab:TPuntero; End; Actual:TPuntero; Actual:TPuntero; End; End;
Begin Begin New(A); New(A); A^.Info:=X; A^.Info:=X; A^.Sig:=NIL; A^.Sig:=A; End; End;
Begin Begin Begin Begin LVacia:=(L.Tope = 0); LVacia:=(L.POcup=0); LVacia:=(L.Cab=NIL); LVacia:=(L.Cab=NIL); End; End; End; End;
Begin Begin Var Var N:Nodo N:Nodo LLlena:=(L.Tope = MAXLISTA); LLlena:=(L.PLibre=0); Begin Begin LLlena:=(MemAvail < sizeOf (N) ); LLlena:=(MemAvail < sizeOf (N) ); End; End; End; End;
Begin Begin Begin Begin LFin:=(L.Actual > L.Tope); LFin:=(L.Actual=0); LFin:=(L.Actual=NIL); LFin:=(L.Actual=L.Cab); End; End; End; End;
Begin Var Begin Begin L.Tope:=0; i:integer; L.Cab:=NIL; L.Cab:=NIL; End; Begin End; End; L.POcup:=0; L.PLibre:=1; For i:=1 To MAXLISTA-1 Do L.Elem[i].Sig:=i+1; L.Elem[MAXLISTA].Sig:=0; End;
Begin Begin Begin Begin L.Actual:=1; L.Actual:=LPOcup; L.Actual:=L.Cab; L.Actual:=L.Cab; End; End; End; End;
Lista Estatica Con Corrimiento Lista Estatica Sin Corrimiento Lista Dinamica Simple Enlace Lineal Lista Dinamica Simple Enlace Circular LECC.PAS LESC.PAS LDSEL.PAS LDSEC.PAS Begin Begin Begin Begin For i:=1 To L.Tope-1 Do aux:=L.PLibre; Aux:=L.Cab; Aux:=L.Cab; L.Elem[i] := L.Elem[i+1]; L.PLibre:=L.POcup; L.Cab:=L.Cab^.Sig; L.Cab:=L.Cab^.Sig; L.Tope := L.Tope-1; L.POcup:=L.Elem[L.POcup].Sig; Dispose(Aux); Dispose(Aux); End; L.Elem[L.PLibre].Sig:=Aux; End; t:=L.Cab; End; While t.Sig <> L.Cab Do t:=t^.Sig; t.Sig:=L.Cab; End;
Begin Var Var Var L.Tope := L.Tope - 1; aux,i:integer; t,Aux:TPuntero t,Aux:TPuntero End; Begin Begin Begin If L.Elem[L.POcup].Sig=0 Then t:=L.Cab; t:=L.Cab; Begin If t^.Sig=NIL then Begin If t^.Sig=L.Cab then Begin L.Elem[L.POcup].Sig:=L.PLibre; Aux:=L.Cab; Aux:=L.Cab; L.PLibre:=L.POcup; L.Cab:=NIL; L.Cab:=NIL; L.POcup:=0; End End End Else Begin Else Begin Else While t^.Sig^.Sig <> NIL Do While t^.Sig^.Sig <> L.Cab Do Begin t:=t^.Sig; t:=t^.Sig; i:=L.POcup; Aux:=t^.Sig; Aux:=t^.Sig; While L.Elem[i].Sig<>0 Do t^.Sig:=NIL; t^.Sig:=L.Cab; Begin End; End; aux:=i; Dispose(Aux); Dispose(Aux); i:=L.Elem[i].Sig; End; End; End; L.Elem[i].Sig:=L.PLibre; L.PLibre:=L.Elem[aux].Sig; L.Elem[aux].Sig:=0; End; End;
Var Var Var Var i: integer; i,j:integer; Aux,t:TPuntero Aux,t:TPuntero Begin Begin Begin Begin For i:=L.Actual to L.Tope-1 Do i:=L.POcup; t:=L.Actual; t:=L.Actual; L.Elem[i] := L.Elem[i+1]; If L.POcup=L.Actual Then If t=L.Cab Then If L.Cab^.Sig = L.Cab Then L.Tope := L.Tope-1; Begin L.Cab:=t^.Sig; Begin End; L.POcup:=L.Elem[i].Sig; Else Begin L.Cab:=NIL; L.Elem[i].Sig:=L.Plibre; Aux:=L.Cab; L.Actual:=NIL; L.PLibre:=i; While Aux^.Sig <> L.Actual Do End L.Actual:=L.POcup; Aux:=Aux^.Sig; Else Begin End Aux^.Sig:=t^.Sig; If t=L.Cab then Else End; L.Cab:=t^.Sig; Begin L.Actual:=t^.Sig Aux:=L.Cab; While L.Elem[i].Sig<>L.Actual Do Dispose(t); While Aux^.Sig <> L.Actual Do i:=L.Elem[i].Sig; End; Aux:=Aux^.Sig; j:=L.Elem[i].Sig; Aux^.Sig:=t^.Sig; L.Elem[i].Sig:=L.Elem[j].Sig; L.Actual:=t^.Sig L.Elem[j].Sig:=L.PLibre; End; L.PLibre:=j; Dispose(t); L.Actual:=L.Elem[i].Sig; End; End; End;
Var Var Var Var
Lista Estatica Con Corrimiento Lista Estatica Sin Corrimiento Lista Dinamica Simple Enlace Lineal Lista Dinamica Simple Enlace Circular LECC.PAS LESC.PAS LDSEL.PAS LDSEC.PAS i,j:integer; i,aux:integer; Aux, t: TPuntero Aux, t: TPuntero Begin Begin Begin Begin L.Tope:=L.Tope+1; aux:=L.PLibre; CrearNodo(Aux, x) CrearNodo(Aux, x) If L.Tope=0 Then L.Elem[aux].Info:=X; If L.Cab = NIL Then If L.Cab = NIL Then L.Elem[1]:=X L.PLibre:=L.Elem[L.PLibre].Sig; L.Cab:= Aux; L.Cab:= Aux Else If (L.POcup=0) Then Else L.Cab^.Sig:= L.Cab Begin Begin If (((Orden=‘A’) AND (L.Cab^.Info.Clave>X.Clave)) OR Else i:=1; L.Elem[aux].Sig:=0; ((Orden=‘D’) AND (L.Cab^.Info.Clave<X.Clave))) Then If (((Orden=‘A’) AND (L.Cab^.Info.Clave>X.Clave)) OR While (((Orden='A') AND (X.Clave > L.Elem[i].Clave)) OR L.POcup:=aux Aux^-.Sig:=L.Cab; ((Orden=‘D’) AND (L.Cab^.Info.Clave<X.Clave))) Then ((Orden='D') AND (X.Clave < L.Elem[i].Clave))) AND End L.Cab:=Aux; Aux^-.Sig:= L.Cab (i < L.Tope) Do Else Else t:= L.Cab i:=i+1; If (((Orden='A') AND (X.Clave<L.Elem[L.POcup].Info.Clave)) OR t:= L.Cab While t^.Sig <> L.Cab Do End; ((Orden='D') AND (X.Clave>L.Elem[L.POcup].Info.Clave))) Then While t^.Sig<>NIL AND t:= t^.Sig For j:=L.Tope To i+1 Do Begin (((Orden='A') AND ( t^.Sig^.Info.Clave < X.Clave)) OR End L.Elem[j]:=L.Elem[j-1]; L.Elem[aux].Sig:=L.POcup; ((Orden='D') AND (t^.Sig^.Info.Clave > X.Clave))) Do t^.Sig := Aux L.Elem[i]:=X; L.POcup:=aux; t:= t^.Sig L.Cab:= Aux End; End End Else End; Else Aux^.Sig :=t^.Sig t:= L.Cab Begin t^.Sig:= Aux While t^.Sig<>L.Cab AND i:=L.POcup; End; (((Orden='A') AND ( t^.Sig^.Info.Clave < X.Clave)) OR While (L.Elem[i].Sig<>0) AND End; ((Orden='D') AND (t^.Sig^.Info.Clave > X.Clave))) Do (((Orden='A') AND (L.Elem[L.Elem[i].Sig].Info.Clave<X.Clave)) OR End; t:= t^.Sig ((Orden='D') AND (L.Elem[L.Elem[i].Sig].Info.Clave>X.Clave))) Do End i:=L.Elem[i].Sig; Aux^.Sig :=t^.Sig L.Elem[aux].Sig:=L.Elem[i].Sig; t^.Sig:= Aux L.Elem[i].Sig:=aux; End; End; End; End; End;
Lista Dinamica Doble Enlace Lineal Lista Dinamica Doble Enlace Circular LDDEL.PAS LDDEC.PAS Begin Begin X :=L.Actual^.Info; X :=L.Actual^.Info; End; End;
Begin Begin L.Actual:=L.Actual^.Sig; L.Actual:=L.Actual^.Sig; End; End;
Begin Begin L.Actual^.Info:=X; L.Actual^.Info:=X; End; End;
Var Var Aux,t:TPuntero Aux,t:TPuntero Begin Begin CrearNodo(Aux,X); CrearNodo(Aux,X); If L.Cab=NIL Then If L.Cab=NIL Then L.Cab:=Aux; L.Cab:=Aux; Else Else Begin Begin t:=L.Cab; t:=L.Cab^.Ant; While t^.Sig <> NIL Do Aux^.Sig:=L.Cab; t:=t^.Sig; Aux^.Ant:=t; Aux^.Ant:=t; t^.Sig:=Aux; t^.Sig:=Aux; End; End; End; End;
Var Var Aux:TPuntero Aux,t:TPuntero Begin Begin CrearNodo(Aux,X); CrearNodo(Aux,X); Aux^.Ant:=LCab^.Ant; If L.Cab=NIL Then Aux^.Sig:=L.Cab; L.Cab:=Aux; LCab^.Ant:=Aux; Else L.Cab:=Aux; Begin End; t:=L.Cab^.Ant; Aux^.Sig:=L.Cab; Aux^.Ant:=t; t^.Sig:=Aux; L.Cab:=Aux; End; End;
Var Var Aux:TPuntero Aux,t:TPuntero
Lista Dinamica Doble Enlace Lineal Lista Dinamica Doble Enlace Circular LDDEL.PAS LDDEC.PAS Begin Begin Aux:=L.Cab; Aux:=L.Cab; L.Cab:=L.Cab^.Sig; L.Cab:=L.Cab^.Sig; Dispose(Aux); t:=Aux^.Ant; L.Cab^.Ant:=NIL L.Cab^.Ant:=t: End; t^.Sig:=L.Cab; Dispose(Aux); End;
Var Var t:TPuntero t:TPuntero Begin Begin t:=L.Cab; t:=L.Cab^.Ant; If t^.Sig=NIL then If t^.Sig=L.Cab then L.Cab:=NIL; L.Cab:=NIL; Else Begin Else Begin While t^.Sig <> NIL Do t^.Ant^.Sig:=L.Cab; t:=t^.Sig; L.Cab^.Ant:=t^.Ant; t^.Ant^.Sig:=NIL; End; End; Dispose(t); Dispose(t); End; End;
Var Var t:TPuntero t:TPuntero Begin Begin t:=L.Actual; t:=L.Actual; If L.Cab^.Sig = NIL Then If L.Cab^.Sig = L.Cab Then Begin Begin L.Cab:=NIL; L.Cab:=NIL; L.Actual:=NIL; L.Actual:=NIL; End End Else Begin Else Begin If t=L.Cab Then If t=L.Cab Then L.Cab:=t^.Sig; L.Cab:=t^.Sig; Else t^.Ant^.Sig:=t^.Sig; t^.Ant^.Sig:=t^.Sig; t^.Sig^.Ant:=t^.Ant; If t^.Sig<>NIL Then L.Actual:=t^.Sig t^.Sig^.Ant:=t^.Ant; End; L.Actual:=t^.Sig Dispose(t); End; End; Dispose(t); End;
Var Var