Ruby wanted to deal with the Map data structure implemented in the tree structure.Are there any classes that meet the following requirements?Do you have any libraries implemented?
h.set(key,value)
and get them with h.get(key)
.They can run below O(log(N))h.find_sup(key)
, a minimum key larger than key
and a corresponding pair of values can be obtained.It can be done with O(log(N))
Try the Gems RBTree.
https://rubygems.org/gems/rbtree/versions/0.4.2
The RBTree Documentation can be viewed from the right side of the linked page.
© 2024 OneMinuteCode. All rights reserved.