Sunday, March 1, 2020

Tugas

Linked List



Definition of Linked List

Linked list is one of data structures where the elements aren't place next to each other in the memory, but rather the element is pointing to the next one. The linked list is used to easily add or remove an element inside a list without reallocating or reorganize the list because the elements aren't stored contiguously inside the memory.

Types of Linked List

Circular Single Linked List
In circular single linked list, there is a pointer placed inside the element that point to the next one. At the last element of the list, the pointer is pointing at the first element of the list. Null value can't be stored in this list.

Doubly Linked List
In doubly linked list, there are 2 pointer placed inside the element that are pointing to the next or previous element. NULL value can be stored in this list.

Circular Double Linked List
Circular double linked list are the combination between circular single linked list and doubly linked list. There are 2 pointer inside the element except the head element that only have one, the pointers are pointing to the next and previous element. The "next" pointer in the last element isn't pointing at the head element, but it's pointing to the element where the head element is pointing at.

No comments:

Post a Comment