|
|
|
|
|
by jstimpfle
3348 days ago
|
|
> i insert sequence of random integers into a sorted sequence, then remove those elements one by one as determined by a random sequence of positions. Which means that you scan the list twice for each node. First for insertion and then for deletion. Starting at maybe a hundred that would be much more efficient with a balanced search tree. They have a good Red-black tree in Linux. But if it's only arrays vs lists - with linked lists, pointers to items are never invalidated. With dynamic arrays, they are. Dynamic arrays are fine for plain old data arrays. But it's harder for data that has "identity" and is frequently mutated. And if a node is in multiple lists, I guess arrays are out. You'd need to store the data redundantly. Extra bad if you need atomic mutations. |
|