3 ms·
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 b
by dleslie 3y ago
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.