Add Floor and Ceiling method to Treemap #82
No reviewers
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!82
Loading…
Reference in a new issue
No description provided.
Delete branch "master"
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?
@loxp Thank you for the input.
May i propose another solution of just exposing the underlying Tree of the TreeMap?
In other words, you could get the same result with
...or do you prefer your solution?
perhaps, given I expose the Tree in the TreeMap and implement the seek iterator withing red-black tree, I could kill two flies with this approach w.r.t. #66
You are right. Moreover, do you think the solution below is better?
All the methods of Tree struct can be invoked directly through a reference to the Map struct, and all the proxy methods of Map struct can be removed.
That was my question to you as well, what do you think, would that work for you?
On another note, just checked on Java's TreeMap that they do expose a lot of these method directly in TreeMap https://docs.oracle.com/javase/7/docs/api/java/util/TreeMap.html so I am wondering if GoDS should do the same. Perhaps accessing the Tree within the map would not be to intuitive and evident for most people and creating proxy functions in our treemap, as you have done, would still be the better approach.
Last night I was more inclined towards exposing the Tree, today I am more inclide towards your approach. Perhaps we could do both, since I can't make up my mind? :D
Is it ok that exposing the Node struct to TreeMap user? If ok, I think exposing the Tree struct is better. In Java, a Map.Entry can be exposed, but in gods there isn't a equivalent abstraction.
after thinking it though a bit, i like your approach better, i.e. creating proxy functions rather than exposing the tree. i will merge this into development branch, make some changes and merge into master thereafter. the changes are minor documentation/comment updates and change of the output parameters to resemble e.g.
in other words removing the thrid output paramter.