I want to do something ordered hash with ruby.

Asked 2 years ago, Updated 2 years ago, 119 views

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?

    You can store values with
  • h.set(key,value) and get them with h.get(key).They can run below O(log(N))
  • In
  • 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))

ruby algorithm data-structure

2022-09-29 22:48

1 Answers

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.


2022-09-29 22:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.