Access: Random / Sequential
1. Array element can be randomly accessed using index
2. Random access for element of linked list costs O(n) time
3. Generally, in linked list, elements are accessed sequentially
Memory Structure
1. Elements of array is stored in contiguous memoery locations.
2. Elements of linked list is stored at any available location. But the pointer to the memory location is stored in Previous Node.
Insertion / Deletion
Array takes more time.
Linked list takes O(1) time.
Memory Allocation
1. For array, memory should be allocated at Compile-Time.
2. For linked list, memory can be allocated at Run-Time.
时间: 2024-10-06 16:37:20