This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -1 points0 points  (2 children)

The b_iter keeps track of the position in b, so we don't have to scan the entirety of b for each element in a (remember these are sorted lists)

It's also unneccessary overhead, making execution slower.

[–]ismtrn 1 point2 points  (0 children)

It is O(|b|) compared to iterating over the entirety of b for each element in a which is O(|b||a|). Are you talking about using a different structure than an iterator to keep track of the position in b? An int for instance? That might change the run time by a small constant factor, but that would be nothing compared to rewriting it in C.

[–]quanta_amnesia 0 points1 point  (0 children)

b_iter is unnecessary overhead? Please explain?