Professional Documents
Culture Documents
Data Structures and Algorithm: Linked List
Data Structures and Algorithm: Linked List
ALGORITHM
Linked List
LINKED LISTS
Insertion:
Array: You might need to re-allocate an array with larger size.
(To add one element to an array of size ∼ 1GB, you an
additional ∼ 1GB)
Linked List: No need to recreate the list, in-place insertion
Deletion:
Array: We need to shift the items
Linked List: We just need to ”re-wire” references
ARRAYS LINKED LISTS(CONTD)
Use an array if:
The size of the list remains fairly static once loaded into
memory.
You need to access random location in the list quickly