C PROGRAMMING AND DATA STRUCTURE
- It is a data Structure which consists if group of nodes that forms a sequence.
- It is very common data structure that is used to create tree,graph and other abstract data types.
No | Element | Explanation |
---|---|---|
1 | Node | Linked list is collection of number of nodes |
2 | Address Field in Node | Address field in node is used to keep address of next node |
3 | Data Field in Node | Data field in node is used to hold data inside linked list. |
Advantages of linked list
List of advantages :
- Linked List is Dynamic data Structure .
- Linked List can grow and shrink during run time.
- Insertion and Deletion Operations are Easier
- Efficient Memory Utilization ,i.e no need to pre-allocate memory
- Faster Access time,can be expanded in constant time without memory overhead
- Linear Data Structures such as Stack,Queue can be easily implemeted using Linked list
- llocate as much memory as we can.
- Though you can allocate any number of nodes, still there is limit for allocation of memory . (We can allocate memory considering that heap size will not be exceeded)
Re-commanded article : Dynamic memory allocation
2. Insertion and Deletion Operations are easy
- Insertion and Deletion operations in Linked List is very flexible.
- We can insert any node at any place easily and similarly we can remove it easily.
- We don’t have to shift nodes like array insertion. In Insertion operation in linked list , we have to just update next link of node.
3. Memory Utilization
- As explained earlier we don’t have to allocate memory at compile time.
- Memory is allocated at run time as per requirement, so that Linked list data structure provides us strong command on memory utilization.
No comments:
Post a Comment