News for hackers. Stuff that matters.
Re:I Accidentally a Scheme by dleslie on Wednesday November 15, 2023 @09:59AM (#38277276)
That's based around a contrived problem that was posed to him:

> Insert a sequence of random integers into a sorted sequence, then remove those elements one by one as determined by a random sequece of positions: Do you use a vector (a contiguously allocated sequence of elements) or a linked list?

The key is that the sequence is sorted; and is kept sorted throughout the insertion process. With a linked list that means at least an O(n) traversal for insertion, so of course it's terrible.

There are no comments on this comment yet.