Rangkuman Data Structure Session 3 (25 Februari 2020)

A. Outline:
  1. Circular Linked List
  2. Doubly Linked List
  3. Circular Doubly Linked List
B. Penjelasan:

1. Circular Single Linked ListCircular Linked List merupakan salah satu jenis Linked List yang pada node akhirnya mengandung pointer yang menunjuk ke node yang awal / pertama.


Hasil gambar untuk circular single linked list


2. Doubly Linked List
dll
Doubly Linked List merupakan salah satu jenis Linked List yang nodenya dapat menunjuk node yang selanjutnya (next) dan node yang sebelumnya (previous)
Insertionkita dapat menambahkan node dengan 2 cara, yaitu:
  • Dibelakang tail
        struct tnode *node = (struct tnode*) malloc(sizeof(struct tnode)); node->value = x; node->next  = NULL; node->prev  = tail; tail->next  = node; tail = node;
  • Diantara Head dan Tail
      struct tnode *a = ??;      struct tnode *b = ??;     // the new node will be inserted between a and b     struct tnode *node = (struct tnode*) malloc(sizeof(struct tnode));     node->value = x;     node->next = b;     node->prev = a;     a->next = node;     b->prev = node;
Deletion4 kondisi yang harus diperhatikan adalah:
  1. Node yang di delete adalah satu-satunya node di linked list
  2. node yang di delete head
  3. node yang di delete tail
  4. node yang di delete bukan head atau tail

3. Circular Doubly Linked List










Hasil gambar untuk circular double linked list
mirip dengan Circular Single Linked list, tetapi di setiap node ada 2 pointer.


SOURCE:
https://www.geeksforgeeks.org/doubly-linked-list/

PPT SESSION 3 BINUS UNIVERSITY

 





Komentar

Postingan Populer