Array |
Linked List |
---|
Size of the array is fixed | Dynamic size |
Less memory required | More memory required |
Stored in contiguous Memory Locations | Stored in non-contiguous Memory Locations |
Memory Should be allocated at Compile-Time | Memory is allocated at Run-Time |
Elements can be modified easily by identifying the index value | Complex process for modifying the node |
Elements cannot be added, deleted once it is declared | Nodes in the linked list can be added and deleted from the list |
Directly access any element in an array | We can’t directly access any element but we need to traverse over the entire list |
Shuffling the elements of an array requires more time | Shuffling the elements of a linked list requires less time |
Access any element in an array take less time | Access any element in an array take more time |
Arrays can hold only one value at a time | It can hold more than one at a time |
![Data Structures - Array Vs Linked List array in c](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMTY3IiB2aWV3Qm94PSIwIDAgMjAwIDE2NyI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgc3R5bGU9ImZpbGw6I2NmZDRkYjtmaWxsLW9wYWNpdHk6IDAuMTsiLz48L3N2Zz4=) | ![Data Structures - Array Vs Linked List linked list in c](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjE1MiIgdmlld0JveD0iMCAwIDEwMCUgMTUyIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBzdHlsZT0iZmlsbDojY2ZkNGRiO2ZpbGwtb3BhY2l0eTogMC4xOyIvPjwvc3ZnPg==) |