LIFO - LAST INDIUM FIRST OUT
Making method of linked list where data entering is most recently is earliest secretary data
If linked list is made with LIFO method, hence addition of node happened rear.
If linked list is made with LIFO method, hence addition of node happened rear.
INITIAL DECLARATION
TYPE
Point = ^RecPoint;
RecPoint = Record
Isi : TipeData;
Next : Point;
End;
VAR
Head, Tail, Now : Point;
PROCEDURE INSERT LIFO
PROCEDURE INSERT (element: data type);
VAR Now: Point;
BEGIN
New (Now);
Now^.Isi := element;
if Head=Nil then
Now^.Next :=Nil;
Else
Now^.Next := Head;
Head: =Now;
End;
PROCEDURE INSERT FIFO
PROCEDURE INSERT (element : data type);
VAR Now: Point;
BEGIN
New (Now);
if Head=Nil then
Head: =Now
else
Tail^.Next :=Now;
Tail: =Now;
Tail^.Next:=nil;
Now^.Isi:= Element;
End;
0 comments:
Post a Comment