Systems and low latency
Traversing a linked list and traversing an array are both O(n).
AppliedMultiple choice
Traversing a linked list and traversing an array are both . Why is the array far faster in practice?
- AArrays use a cheaper instruction for each element access
- BContiguous memory is prefetched; pointers are chased
- CLinked lists must be sorted before they can be traversed
- DThe compiler can unroll an array loop but not a list loop
The worked solution is in Premium
The answer, the full working and the one idea to take away – for this and all 1,322 questions in the bank. Answer it in practice and your working is marked, with a known mistake named when you make one.
Report an issue with this question
Learn the method
Of the kind reported at
More systems and low latency questions
- Walking a matrix through the cache, part 3 of 3Advanced · Premium
- AVX-512 registers are 512 bits wide. How many float64 values does one hold?Foundation · Premium
- A cache line is 64 bytes. How many 32-bit integers fit in one?Foundation · Premium
- A single scan reads 1 GB from main memory at a sustained 20 GB/s.Foundation · Premium
- Walking a matrix through the cache, part 1 of 3Foundation · Premium
- An L1 data cache holds 32 KB. How many float64 values fit in it?Applied · Premium