Linked List 101

         Looking back from the previous semester, we have studied several elements about programming such as Array, which is a collection of stored items at neighboring memory locations. In this post, we are going to learn about a linear data structure called Linked List. Unlike Array, Linked List elements are not stored at contiguous memory locations but rather, the elements are linked through pointers as shown in the image below:



In this post, we are going to look at several types of  Linked List, such as:

  • Doubly Linked List
  • Circular Linked List

DOUBLY LINKED LIST
                  Contains an extra pointer (previous pointer, next pointer, and data) which are in a form of singly linked list.
dll

CIRCULAR LINKED LIST
                  Since all nodes are connected to form a circle, there is no way for NULL to appear at the end. Any nodes can be a starting point, yet it is useful for implementation of queue and  in applications to repeatedly go around the list. A Circular Linked List can be Circular Singly Linked List or Doubly Circular Linked List.



  • Circular Singly Linked List
                  Circular Singly Linked List is a combination between Singly Linked List and Circular Linked List which makes it to have only one variable pointer that points to the next nodes, whose last node shall points back to the first node, creating an endless loop which stucture thus formed like this:


  • Doubly Circular Linked List
                  Doubly Circular Linked List is a combination between Doubly Linked List and Circular Linked List which makes the previous pointer, next pointer, and data to link to one another. As well as Circular Singly Linked List, the last node in Doubly Circular Linked List shall points back to the first node, creating an endless loop which stucture thus formed like this:
Circular doubly linked list
References:
www.geeksforgeeks.org/linked-list-set-1-introduction/
www.geeksforgeeks.org/data-structures/linked-list/
www.geeksforgeeks.org/array-data-structure/
www.geeksforgeeks.org/circular-linked-list/
www.geeksforgeeks.org/circular-singly-linked-list-insertion/
www.geeksforgeeks.org/doubly-circular-linked-list-set-1-introduction-and-insertion/
www.geeksforgeeks.org/doubly-linked-list/

Komentar