Hacker News new | ask | show | jobs
by flukus 3082 days ago
> Yes, it is. But why 'the worst' aspects of each, though? I see it as the opposite: linked lists built on top of vectors combine good cache efficiency of vectors with algorithmic benefits of linked lists (many operations become O(1), or at least in the amortized sense).

That's really going to depend on the size of the list, if it's larger than the cache size then it's not as quick to iterate over as a vector because it's jumping around to random (albeit contiguous) memory.

> Generally speaking, I think anyone learning Rust and trying to implement a graph data structure should first do it on top of a vector.

That really depends on why your learning it. Typically when I'm learning/evaluating a new language I run through pain points like this because it show you the good and the bad.