I need to perform following queries What data structure can i use or modify to.
1) Insert/delete an element(comparable) , say integer , in some order such that i.e. iteration from smallest to largest element at any time , takes O(number of elements) .
2) number of elements greater than ei is given in O(logn) .
...I thought of adding an attribute at each node of r-b tree which stores number of elemts in subtree rooted at that element but this seems incorrect too .
I think it's absolutely correct. In my opinion 2) can be done in a manner like this (pseudocode):
I hope you see the time complexity is per query.
Thanks , yes i got that now .Seems obvious now.
you can use GNU-specific
pbds
namespace.tutorial
my recent submission: 10490550
Thanks for the link .