Module: Lite::Containers::AvlTree::Find

Included in:
Implementation
Defined in:
lib/lite/containers/avl_tree/find.rb

Defined Under Namespace

Modules: Exact, ExactOrNearestBackwards, ExactOrNearestForwards, Inexact

Instance Method Summary collapse

Instance Method Details

#leftmost_child(node) ⇒ Object



9
10
11
12
13
# File 'lib/lite/containers/avl_tree/find.rb', line 9

def leftmost_child(node)
  return node if node.left.nil?

  leftmost_child(node.left)
end

#rightmost_child(node) ⇒ Object



15
16
17
18
19
# File 'lib/lite/containers/avl_tree/find.rb', line 15

def rightmost_child(node)
  return node if node.right.nil?

  rightmost_child(node.right)
end