Arrays and Linked Lists both are linear data structures, but they both have some advantages and disadvantages over each other.
One advantage of the linked list is that elements can be added to it indefinitely, while an array will eventually get filled or have to be resized (a costly operation that isn't always possible).
Elements are also easily removed from a linked list whereas removing elements from an array leaves empty spaces that are a waste of computer memory.
However, unlike arrays which allow random access to the elements contained within them, a link list only allows sequential access to its elements. Linked lists also use more storage space in a computer's memory as each node in the list contains both a data item and a reference to the next node.
It follows that linked lists should be used for large lists of data where the total number of items in the list is changing. Arrays, on the other hand, are better suited to small lists, where the maximum number of items that could be on the list is known.
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Sort Binary Linked List | 200 |
|
33:21 | |
Partition List | 275 |
|
49:36 | |
Insertion Sort List | 300 |
|
49:25 | |
Sort List | 350 |
|
59:53 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Palindrome List | 200 |
|
47:06 | |
Remove Duplicates from Sorted List II | 300 |
|
57:51 | |
Merge Two Sorted Lists | 300 |
|
29:11 | |
Remove Duplicates from Sorted List | 300 |
|
17:58 | |
Remove Nth Node from List End | 350 |
|
27:38 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
K reverse linked list | 200 |
|
60:30 | |
Even Reverse | 200 |
|
45:58 | |
Swap List Nodes in pairs | 350 |
|
33:34 | |
Rotate List | 350 |
|
33:58 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Kth Node From Middle | 200 |
|
30:12 | |
Reverse Alternate K Nodes | 300 |
|
54:08 | |
Reverse Link List II | 450 |
|
57:24 | |
Reorder List | 600 |
|
57:10 |
Problem | Score | Companies | Time | Status |
---|---|---|---|---|
Add Two Numbers as Lists | 250 |
|
43:07 | |
List Cycle | 600 |
|
39:15 |