lib/treemap/tree_map.rb
def prev_node
      return @left.last if @left

      node = self
      parent = node.parent
      while parent
        if parent.right == node
          return parent
        end
        node = parent
        parent = node.parent
      end
      nil
    end
# Returns the previous node in an inorder traversal, or null if this is the first node in the tree.
Returns the previous node in an inorder traversal, or null if this is the first node in the tree.
Returns the previous node in an inorder traversal or null if this is the first node in the tree .
def prev_node
      return @left.last if @left
      node = self
      parent = node.parent
      while parent
        if parent.right == node
          return parent
        end
        node = parent
        parent = node.parent
      end
      nil
    end
def prev_node return @left . last if @left node = self parent = node . parent while parent if parent . right == node return parent end node = parent parent = node . parent end nil end
Returns the previous node in an inorder traversal, or null if this is the first node in the tree.
Returns the previous node in an inorder traversal or null if this is the first node in the tree .