Presentation is loading. Please wait.

Presentation is loading. Please wait.

Subject Name : Data Structure Using C Title : Linked Lists

Similar presentations


Presentation on theme: "Subject Name : Data Structure Using C Title : Linked Lists"— Presentation transcript:

1 Subject Name : Data Structure Using C Title : Linked Lists
Home Next

2 Linked Lists It consists of a sequence of nodes, each containing arbitrary data fields and one or two references ("links") pointing to the next and/or previous nodes. A linked list is a self-referential data type because it contains a pointer or link to another datum of the same type. Linked lists permit insertion and removal of nodes at any point in the list in constant time, but do not allow random access. The principal benefit of a linked list over a conventional array is that the order of the linked items may be different from the order that the data items are stored in memory or on disk, allowing the list of items to be traversed in a different order. Several different types of linked list exist: Singly Linked List, Doubly Linked List, and Circular Linked List. Home Next

3 Hierarchical Structure of Linear List
Linear Lists Restricted LIFO FIFO General Random General Ordered Home Next

4 There are basic FOUR operations performed on linear lists
Insertion of Nodes : an insertion can be made at the any of the lists Deletion of Nodes : Deletion from general list requires that the list be searched for the data to be deleted. Retrieval of Values : List retrieval requires that data be located in a list and presented to the calling module without changing the contents of the lists. Traversal in the List : List traversal is a special case of retrieval in which all the elements are retrieved in a sequence. Home Next

5 Singly Linked List Doubly Linked List Circular Linked List
Type of Linked Lists Singly Linked List Doubly Linked List Circular Linked List Home Next

6 Arbitrary Address of the Node
Singly Linked List Arbitrary Address of the Node 100 300 400 200 700 6 300 100 9 400 12 200 5 700 -10 NULL Tail Node Head Node Data Part Address Part Home Next

7 Insertion of a Node in Singular Link List : Insert node value 45 after node value 9
100 300 400 200 700 6 300 100 9 400 -10 NULL (1) 12 200 5 700 600 Head Node Tail Node 45 NULL Insertable Node 100 300 400 200 700 (2) 6 300 100 9 600 12 200 5 700 -10 NULL 600 Head Node Tail Node 45 400 Inserted Node Home Next

8 Deletion of a Node in Singular Link List : Delete node value 12
100 300 400 200 700 6 300 100 9 400 12 200 5 700 -10 NULL (1) Head Node Tail Node 100 300 400 200 700 6 300 100 9 200 (2) 12 200 5 700 -10 NULL Head Node Tail Node Home Next

9 Doubly Linked List 9 300 NULL 100 7 600 100 86 200 300 91 NULL 600
Data Part 100 300 600 200 9 300 NULL 100 7 600 100 86 200 300 91 NULL 600 Head Node Tail Node Address Part Home Next

10 Insertion of a Node in Doubly Link List : Insert node value 45 after node value 7
100 300 600 200 (1) 9 300 NULL 100 7 600 100 86 200 300 91 NULL 600 700 Head Node Tail Node 45 NULL Insertable Node 100 300 600 200 9 300 NULL 100 7 700 100 86 200 700 91 NULL 600 (2) 700 Head Node Tail Node 45 600 300 Inserted Node Home Next

11 Deletion of a Node from Doubly Link List : Delete node value 86
100 300 600 200 (1) 9 300 NULL 100 7 600 100 86 200 300 91 NULL 600 Head Node Tail Node 100 300 600 200 9 300 NULL 100 7 200 100 86 200 300 91 NULL 300 (2) Head Node Tail Node Home Next

12 Circular Linked List 100 300 400 200 700 6 300 100 9 400 12 200 5 700 -10 100 Tail Node Head Node Home Next

13 Insertion of a Node in Circular Link List : Insert node value 44 after node value 12
100 300 400 200 700 6 300 100 9 400 12 200 5 700 -10 100 (1) 500 44 NULL Tail Node 100 300 400 200 700 6 300 100 9 400 12 500 5 700 -10 100 (2) 500 Tail Node 44 200 Home Next

14 Deletion of a Node from Circular Link List : Delete the node value 5
100 300 400 200 700 6 300 100 9 400 12 200 5 700 -10 100 Tail Node 100 300 400 200 700 6 300 100 9 400 12 700 5 700 -10 100 Tail Node Home Next

15 Application of Linked List
Large Numeric Arithmetic Optimum Utilization of Memory Space Represent Complex Structure – Tree, Graph Home Next

16


Download ppt "Subject Name : Data Structure Using C Title : Linked Lists"

Similar presentations


Ads by Google