Comments by "LoneTech" (@0LoneTech) on "Arrays vs Linked Lists - Computerphile" video.
-
It's quite a bit more complicated. For instance, with the structs shown, the linked list is likely twice as large even before taking into account memory allocator overhead. Just as importantly, traversing the entire list is not necessarily your most important operation, and the linked list makes operations like insertion, removal and append (if you track the tail) quite fast, while the array may need to copy all other elements each time. As for heaps, we have two things commonly named that; the memory allocation heap and a heap queue. The heap queue algorithm maintains a sort of ordering within an array at a limited cost, such that you can always extract the first item. It maintains a type of binary tree, and the technique is applicable to other structures.
In short, horses for courses.
14