|
|
|
|
|
by tayo42
635 days ago
|
|
The interleave thing isnt intuitive to me. The problem with linked lists is the memory address of nodes isn't necessarily contiguous because of malloc and the value could be NULL? Why does interleave loop make it faster for the cpu? It still a linked list, arbitrary memory, could be NULL? Not sure what im missing here? |
|
If there are two lists, in the first example, you're doing:
In the 2nd example, you're doing Visiting the same number of nodes, but because the nodes are referenced from an array, when you load `a1` you're [probably] also going to load `a2` into the cache.