Pertemuan 7 Circular List Bernadus Anggo Seno Aji
Pertemuan 7 (Circular List) Bernadus Anggo Seno Aji Pangestu Widodo
Outline Pengertian Circular List Insert dan Delete pada Circular List
Circular Linked List Salah satu variasi dari Linked List dimana elemen list terakhir (Last Element) menunjuk/menyambung ke elemen pertama (First Element) L 15 30 40
4 Circular Linked List Circular list biasanya terurut Circular list sangat berguna untuk “Looping” video atau sound. Circular list merupakan batu loncatan untuk implementasi graf. 11/1/2020
5 Directive #define membuat sebuah macro, pengindentifikasi dengan sebuah string dimana akan berasosiasi dengan #define info(P) (P)->info #define next(P) (P)->next #define first(L) ((L). first) 11/1/2020
6 Exercise P First 13 15 25 30 Task : Draw the Pointer Q next(P) R next(First(L))) S next(Q) 11/1/2020
7 Exercise P First 13 15 Task : what is the output? 25 30 Answer Info(Next(p))) Info(Next(next(First(L)))) Info(next(P)) Info(First(L)) 11/1/2020
Question?
9 Same Structure Untuk List dan Elemen sama dengan single linked list yg biasa ADT Create new list Allocation / create new element Perbedaan dalam inserting dan deleting Insert first and last Delete first and last 11/1/2020
10 Insert to Empty List single list circular Algorithm next(P) first(L) P next(P) first(L) P L 15 / 11/1/2020
11 Delete the last element single list circular Algorithm P first(L) next(P) Nil first(L) Nil P L 15 P / 11/1/2020
Insert Last 12 single list circular Kamus Q : address P Algoritma /* buat mekanisme Q menunjuk Last Element*/ next(P) first(L) next(Q) P 15 Q L 30 / 50 11/1/2020
Insert First 13 single list circular Kamus L Q : address P Algoritma /* buat mekanisme Q menunjuk Last Element*/ next(P) first(L) next(Q) P first(L) P 15 Q L 30 50 11/1/2020
14 Delete First single list circular Dictionary Q : address Algorithm /* buat mekanisme Q menunjuk Last Element*/ P first(L) next(P) Nil next(Q) first(L) P P L Q L 30 / 50 15
15 Delete Last single list circular Dictionary Q : address Algorithm /* buat mekanisme Q menunjuk elemen sebelum Last Element*/ P next(Q) first(L) next(P) Nil P Q L 30 50 P 15 /
16 Insert After and Delete After Sama dengan single linked list yang biasa 11/1/2020
Question?
THANK YOU 1 8 11/1/2020
- Slides: 18