Advantages of an array | Disadvantages of an array |
We can access any element of an array directly means random access is easy | Its size is fixed |
It can be used to create other useful data structures (queues, stacks) | It cannot be dynamically resized in most languages |
It is light on memory usage compared to other structures | It is hard to add/remove elements |
| Size of all elements must be same. |
| Rigid structure (Rigid = Inflexible or not changeable) |
Advantages of Linked List | Advantages of Linked List |
Linked lists are dynamic data structures: That is, they can grow or shrink during execution of a program. | Random access is not allowed. We have to access elements sequentially starting from the first node. So we cannot do binary search with linked lists. |
Efficient memory utilization: Here memory is not pre-allocated. Memory is allocated whenever it is required. And it is deallocated (free) when it is no longer needed. | It cannot be easily sorted |
Insertion and deletions are easier and efficient: Linked list provide flexibility in inserting a data item at a specified position and deletion of a data item from the given position. | We must traverse 1/2 the list on average to access any element |
Elements of linked list are flexible: It can be primary data type or user defined data types | Elements of linked list are flexible: It can be primary data type or user defined data types |
| Extra memory space for a pointer is required with each element of the list |
Download the Android app to get all Government Job Notifications on your Mobile.
Download Now
Important: Please always Check and Confirm the above details with the official Advertisement / Notification.