day307

package
v0.0.0-...-36687a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 1 Imported by: 0

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 ErrNoAnswer

func ErrNoAnswer() error

ErrNoAnswer returns the error returned for no answer.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL