4 ms·
Agreed, but for the example the object only needs to live in one list (as shown by the fact that it could have been a C struct that contained the next/prev poin
by icefox 14y ago
Agreed, but for the example the object only needs to live in one list (as shown by the fact that it could have been a C struct that contained the next/prev pointers) so passing iterator would have been sufficient and would have solved the O(n) problem(s?) he was having.
- dkersten 14y agoExactly, the C example could not be contained in more than one list at a time, so if this is a concern, the C solution wouldn't work either.