Re:Data structures and algorithms problems in C++ using STL
by openasocket on Friday March 10, 2017 @11:18AM
(#13839686)
OK, now I see why this is hard, thanks. Now I'm gonna spend the next few days mulling over this problem :)
I noticed the problem is relatively easy if you're dealing with a linked list instead of an array, because you can easily move elements around. If there's some way to amortize that in the array case...
Re:Data structures and algorithms problems in C++ using STL
by cousin_it on Friday March 10, 2017 @11:30AM
(#13839787)
A linked list has O(n) extra space to play with, compared to an array, so of course everything is easier. You can't transfer algorithms from one to the other.
I noticed the problem is relatively easy if you're dealing with a linked list instead of an array, because you can easily move elements around. If there's some way to amortize that in the array case...