Presentation is loading. Please wait.

Presentation is loading. Please wait.

Defri Kurniawan defri.kurniawan@dsn.dinus.ac.id STACK DENGAN LIST Defri Kurniawan defri.kurniawan@dsn.dinus.ac.id.

Similar presentations


Presentation on theme: "Defri Kurniawan defri.kurniawan@dsn.dinus.ac.id STACK DENGAN LIST Defri Kurniawan defri.kurniawan@dsn.dinus.ac.id."— Presentation transcript:

1 Defri Kurniawan defri.kurniawan@dsn.dinus.ac.id
STACK DENGAN LIST Defri Kurniawan

2 RENCANA KEGIATAN PERKULIAHAN SEMESTER
W Pokok Bahasan 1 ADT Stack 2 ADT Queue 3 List Linear 4 5 6 Representasi Fisik List Linear 7 Variasi List Linear 8 Ujian Tengah Semester W Pokok Bahasan 9 Variasi List Linear 10 Double Linked List 11 Stack dengan Representasi List 12 Queue dengan Representasi List 13 List Rekursif 14 Pohon dan Pohon Biner 15 Multi List 16 Ujian Akhir Semester

3

4

5

6

7

8

9

10

11 Operasi-operasi StackList
void CreateStack(Stack *S) { TOP(*S) = Nil; } boolean IsEmpty(Stack S) { return (TOP(S)==Nil); boolean IsFull(Stack S) { return (NbElmt(S)==MaxEl);

12 Alokasi address Alokasi(infotype X) { address P; P = (address)malloc(sizeof(ElmtStack)); if(P!=Nil) { Info(P) = X; Next(P) = Nil; } else { P = Nil; } return P;

13 Operasi Push void Push(Stack *S, infotype X) { address P; P = Alokasi(X); if(IsEmpty(*S)) { TOP(*S) = P; }else if(IsFull(*S)) { print("Stack Full\n"); }else { Next(P) = TOP(*S); }

14 Operasi Pop void Pop(Stack *S, infotype *X) { address P; if(IsEmpty(*S)) { printf("Stack kosong\n"); } else { P = TOP(*S); *X = Info(P); if(Next(P)==Nil) { TOP(*S) = Nil; TOP(*S) = Next(TOP(*S)); } Next(P) = Nil; Dealokasi(&P);

15 TERIMA KASIH


Download ppt "Defri Kurniawan defri.kurniawan@dsn.dinus.ac.id STACK DENGAN LIST Defri Kurniawan defri.kurniawan@dsn.dinus.ac.id."

Similar presentations


Ads by Google