I know that SortedDictionary is a binary search tree (and it can almost do what I need to do!) but I can’t figure out how to do everything I need in the correct complexity.
So here are the constraints (and the data structure which I know has it)
- Inserting and Deletion in
O(log n)(SortedDictionary) - Search in
O(log n)(SortedDictionary & SortedList) - Iteration from one searched element to another in
O(log n) + O(m)(wheremis the number of elements in between) (SortedList)
As you can see, I don’t know how to get SortedDictionary to do number 3. Basically what I need to do is get all the elements with a range without iterating the set.
Please tell me if my question isn’t clear.
This seems to describe a B+ tree perfectly: http://en.wikipedia.org/wiki/B%2B_tree :
A C# implementation seems to exist here: http://bplusdotnet.sourceforge.net/