Random Posts
Cari Blog Ini
Diberdayakan oleh Blogger.
Arsip Blog
- April 2020 (1)
- Maret 2020 (4)
Kontributor
Lorem 1
Technology
Circle Gallery
‹
›
Shooting
Racing
News
Lorem 4
- Circular Single Linked List, Doubly Linked List, & Circular Doubly Linked List
- Stack & Queue
- Hashing Table & Binary Tree
- Binary Search Tree
Circular Single Linked List
• In circular, last node contains a pointer to the first node
• We can have a circular singly linked list as well as a circular doubly linked list.
• There is no storing of NULL values in the list
Advantages of Circular Linked Lists:
1) Any node can be a starting point.
2) Useful for implementation of queue.
3) Circular lists are useful in applications to repeatedly go around the list.
4) Circular Doubly Linked Lists are used for implementation of advanced data structures like Fibonacci Heap.
Doubly Linked List
Double/Doubly linked list (DLL) or two-way linked list is a linked list data structure with
two link, one that contain reference to the next data and one that contain reference to the
previous data.
Advantages over singly linked list:
1) A DLL can be traversed in both forward and backward direction.
2) The delete operation in DLL is more efficient if pointer to the node to be deleted is given.
3) We can quickly insert a new node before a given node.
Disadvantages over singly linked list:
1) Every node of DLL Require extra space for an previous pointer.
2) All operations require an extra pointer previous to be maintained.
Doubly Linked List: Insertion
A node can be added in four ways:
1) At the front of the DLL.
2) After a given node.
3) At the end of the DLL.
4) Before a given node.
Doubly Linked List: Deletion
There are 4 conditions we should pay attention when deleting:
1) The node to be deleted is the only node in linked list.
2) The node to be deleted is head.
3) The node to be deleted is tail.
4) The node to be deleted is not head or tail.
Circular Doubly Linked List
Circular Doubly Linked List has properties of both doubly linked list and circular linked list in
which two consecutive elements are linked or connected by previous and next pointer and
the last node points to first node by next pointer and also the first node points to last node
by previous pointer.
Stacks Concept
A stack is a container of objects that are inserted and removed
according to the last-in first-out (LIFO) principle. In the pushdown
stacks only two operations are allowed: push the item into the stack, and pop the
item out of the stack. A stack is a limited access data structure -
elements can be added and removed from the stack only at the top. push adds an item to the top of the stack, pop removes
the item from the top. A helpful analogy is to think of a stack of
books; you can remove only the top book, also you can add a new book on
the top.A stack is a recursive data structure. Here is a structural definition of a Stack:
Langganan:
Postingan (Atom)