Gabe Moothart said:
Hi,
I agree with the others that the Red/Black tree should be easy to fix, and
the SortedList will probably do what you want, too.
But you could also try my favorite data structure, the SkipList. There is
a c# implementation on CodeProject here:
http://www.codeproject.com/csharp/SkipList1.asp.
The article includes benchmarks against a SortedList, and SkipList beats
it handily. SkipList is also much simpler than a Red/Black tree, and
should give better average performance. You'll have to test this to be
sure, though.
Gabe
I also thought of a SkipList, as it is a pretty neat alogorithm.
But then I had a look at his requirements:
1. A lot of data
2. Fast find.
2. Fast change.
Feel free to invent something that does this for him.
Really, if any one of us can do this, you better get the patent. Then you
can always call Google and license it to them. Don't think they would return
your call thou. Or just tell the whole world that every book on Ordos
(Big-O) is obsolete.
Either way: You will get a nobel price.
This is a classic problem.
Also why there is a market for high-inserts-databases (like billing systems,
Vodaphone do need to store that you made a call to charge you)... to
transactional databases (vanilla).. to
read-only-with-few-increments-databases (search-engines)
Back to SkipLists. While SkipList being smart and funny to code, they only
perform in theory. With virtual memory you get a lot of page-faults and
disk-swapping. This is why most databases work with 'blocks' and 'buckets'
to make sure that the Principle Of Locality somewhat holds.
But what I'm pondering on is; How often do it need to get sorted?
If there are 1000 changes for each read, I would consider a red-black-tree
with tree-sort on top of that.
Might involve a lot of RAM though....
- Michael S
but the requirements demands fast inserts and deletes.