Class: ConsistentHashing::AVLTree
- Inherits:
-
AVLTree
- Object
- AVLTree
- ConsistentHashing::AVLTree
- Defined in:
- lib/consistent_hashing/avl_tree.rb
Instance Method Summary collapse
Instance Method Details
#minimum_pair ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/consistent_hashing/avl_tree.rb', line 6 def minimum_pair() # Return the key with the smallest key value. return nil if @root.empty? current_node = @root while not current_node.left.empty? current_node = current_node.left end [current_node.key, current_node.value] end |
#next_gte_pair(key) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/consistent_hashing/avl_tree.rb', line 18 def next_gte_pair(key) # Returns the key/value pair with a key that follows the provided key in # sorted order. node = next_gte_node(@root, key) [node.key, node.value] if not node.empty? end |