I need to find a data structure which I can do with the following actions:
- Build(S,k) - O(nlogn)
- Search(S,k) - O(logn)
- Insert(S,k) - O(logn)
- Delete(S,k) - O(logn)
- Decrease-Upto(s,k,d) - O(logn) - this method should subtract d(d>0) every node which is <=k
The obvious first choise was RedBlackTree.
However, I can't come to a solution regarding Decrease-Upto in O(Logn). what happens if k is greater then the max key in the tree - that case i gotta update the whole tree.
Can someone suggest otherwise ? maybe some tips ?