Add to treemap functions that search a key (similar to Floor/Ceiling) and return Iterator #193
Labels
No labels
bug
discussion
documentation
duplicate
ignore
new feature
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
golibs/gms-gods#193
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I want to find an element in the tree for O(logN) time and then do a O(1) navigation to the next/prev from there. Similar to c++:
This is already possible with the stated requirements, see example below:
Let me know if this helps or otherwise I'll reopen the question.
Thank you for your response, however, I still have a question: there is no IteratorAt function in the https://github.com/emirpasic/gods/blob/master/maps/treemap/treemap.go The example you provided is about github.com/emirpasic/gods/trees/redblacktree. What is the difference between them? Why not provide IteratorAt to treemap.Map?
Thank you.
@vlkv RedBlackTree is the foundation of the TreeMap anyways, so essentially they are the same. The key difference is that the TreeMap is "branded" as key-value structure and avoids dealing with the internal red-black tree representation of nodes. Do you think you can then simply use the RedBlackTree instead for your case to have this flexibility or should GoDS expose similar IteratorAt functionality?
I looked closely through the public interface that both structures expose and now I see, that the major difference between them probably in that rbt exposes the Node abstraction and treemap - does not.
Yes, sure.
I was expected to see something like c++ std::map or Java's TreeMap and I didn't. But this is simply because of my poor knowlegde of GoDS. Honestly I don't know, this is more of a GoDS philosophy/ideology question, so it's up to you.
Thank you for your help))