Greetings, fellow programmers,
I have more of a feedback request rather than a question. I took the source code of java.util.TreeMap and enhanced it to support accessing and retrieving elements by index (offset from the beginning of the sorted key set).
You can find the project and details here: http://code.google.com/p/indexed-tree-map/
My questions are:
- what open source license (most liberal) can I use when basing some work on JDK's source code
- what pros/cons (mostly cons) do you see in this implementation?
- if these classes (IndexedTreeMap, IndexedTreeSet) are ever to be included in the JDK what is the right way to go?
I faced the index problem myself and implemented this for a project I'm working on, while looking for a solution I found that many people have the same problem. Just look up questions on stackoverflow that are related to SortedTree/SortedSet and List or index position.
i took a quick peek at the code. one thing i noticed is that you double the traversal time on put: first you go down (normal), then you go back up to update the weights. seems like you should be able to do this all in a single pass (update weights on the way down).