Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CeilingFaster ¶
func CeilingFaster(root *BinaryTree, target int) (int, error)
CeilingFaster returns the lowest element in the tree greater than or equal to the target. Returns an error if no answer exists.
func CeilingRecursive ¶
func CeilingRecursive(root *BinaryTree, target int) (int, error)
CeilingRecursive returns the lowest element in the tree greater than or equal to the target. Returns an error if no answer exists.
func FloorFaster ¶
func FloorFaster(root *BinaryTree, target int) (int, error)
FloorFaster returns the highest element in the tree less than or equal to the target. Returns an error if no answer exists.
func FloorRecursive ¶
func FloorRecursive(root *BinaryTree, target int) (int, error)
FloorRecursive returns the highest element in the tree less than or equal to the target. Returns an error if no answer exists.
Types ¶
type BinaryTree ¶
type BinaryTree struct {
Value int
Left, Right *BinaryTree
}
BinaryTree is a binary tree of integers.
Click to show internal directories.
Click to hide internal directories.