chapter4

package
v0.0.0-...-45e99ae Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLevelLinkedList

func CreateLevelLinkedList(root *BinaryTreeNode) []*list.List

func Depth

func Depth(node *ParentAwareBinaryTreeNode) int

func DepthFirstSearchBinaryTree

func DepthFirstSearchBinaryTree(node *BinaryTreeNode) []interface{}

func IntToInterfaceSlice

func IntToInterfaceSlice(array []int) []interface{}

func StringToInterfaceSlice

func StringToInterfaceSlice(array []string) []interface{}

Types

type BinaryTreeNode

type BinaryTreeNode struct {
	Value interface{}
	Left  *BinaryTreeNode
	Right *BinaryTreeNode
}

func GetBinaryTreeFromSortedArray

func GetBinaryTreeFromSortedArray(array []int) *BinaryTreeNode

func (*BinaryTreeNode) AllSequences

func (root *BinaryTreeNode) AllSequences() *list.List

func (*BinaryTreeNode) CheckBalancedHeight

func (root *BinaryTreeNode) CheckBalancedHeight() int

func (*BinaryTreeNode) ContainsTree

func (root *BinaryTreeNode) ContainsTree(childRoot *BinaryTreeNode) bool

func (*BinaryTreeNode) CountPathsWithSum

func (root *BinaryTreeNode) CountPathsWithSum(targetSum int) int

func (*BinaryTreeNode) GetBinaryHeight

func (root *BinaryTreeNode) GetBinaryHeight() int

func (*BinaryTreeNode) HasSubTree

func (root *BinaryTreeNode) HasSubTree(childRoot *BinaryTreeNode) bool

func (*BinaryTreeNode) IsBalanced

func (root *BinaryTreeNode) IsBalanced() bool

func (*BinaryTreeNode) IsBalancedUsingHeightCheck

func (root *BinaryTreeNode) IsBalancedUsingHeightCheck() bool

func (*BinaryTreeNode) IsBinarySearchTree

func (root *BinaryTreeNode) IsBinarySearchTree() bool

func (*BinaryTreeNode) IsBinarySearchTreeWithMinMax

func (root *BinaryTreeNode) IsBinarySearchTreeWithMinMax(min int, max int) bool

func (*BinaryTreeNode) MatchTree

func (root *BinaryTreeNode) MatchTree(childRoot *BinaryTreeNode) bool

type DependencyGraph

type DependencyGraph struct {
	Nodes      []*Project
	ProjectMap map[string]*Project
}

func BuildGraph

func BuildGraph(projects []string, dependencies [][]string) DependencyGraph

func (*DependencyGraph) AddEdge

func (graph *DependencyGraph) AddEdge(startName string, endName string)

func (*DependencyGraph) GetNodes

func (graph *DependencyGraph) GetNodes() []*Project

func (*DependencyGraph) GetOrCreateNode

func (graph *DependencyGraph) GetOrCreateNode(name string) *Project

type Graph

type Graph struct {
	Nodes []GraphNode
}

func (*Graph) GetNodeFromName

func (graph *Graph) GetNodeFromName(name string) GraphNode

func (*Graph) RouteExists

func (graph *Graph) RouteExists(start string, end string) bool

type GraphNode

type GraphNode struct {
	Value    interface{}
	Children []interface{}
}

type ParentAwareBinaryTreeNode

type ParentAwareBinaryTreeNode struct {
	Value  interface{}
	Left   *ParentAwareBinaryTreeNode
	Right  *ParentAwareBinaryTreeNode
	Parent *ParentAwareBinaryTreeNode
}

func CreatParentAwareBinarySearchTree

func CreatParentAwareBinarySearchTree(array []interface{}) *ParentAwareBinaryTreeNode

func (*ParentAwareBinaryTreeNode) CommonAncestor

func (node *ParentAwareBinaryTreeNode) CommonAncestor(node1Value interface{}, node2Value interface{}) *ParentAwareBinaryTreeNode

func (*ParentAwareBinaryTreeNode) GetNodesAsSlice

func (node *ParentAwareBinaryTreeNode) GetNodesAsSlice() []*ParentAwareBinaryTreeNode

func (*ParentAwareBinaryTreeNode) InOrderSuccessor

func (node *ParentAwareBinaryTreeNode) InOrderSuccessor() *ParentAwareBinaryTreeNode

type Project

type Project struct {
	Children []*Project
	Name     string

	ProjectMap map[string]*Project
	// contains filtered or unexported fields
}

func CreateProject

func CreateProject(name string) *Project

func FindBuildOrder

func FindBuildOrder(projects []string, dependencies [][]string) []*Project

func (*Project) AddNeighbour

func (project *Project) AddNeighbour(node *Project)

func (*Project) DecrementDependencies

func (project *Project) DecrementDependencies()

func (*Project) GetChildren

func (project *Project) GetChildren() []*Project

func (*Project) GetName

func (project *Project) GetName() string

func (*Project) GetNumberDependencies

func (project *Project) GetNumberDependencies() int

func (*Project) IncrementDependencies

func (project *Project) IncrementDependencies()

type RandomTreeNode

type RandomTreeNode struct {
	Value       int
	Left, Right *RandomTreeNode
	Size        int
}

func NewRandomTreeNode

func NewRandomTreeNode(value int) *RandomTreeNode

func (*RandomTreeNode) Find

func (root *RandomTreeNode) Find(value int) *RandomTreeNode

func (*RandomTreeNode) GetRandomNode

func (root *RandomTreeNode) GetRandomNode() *RandomTreeNode

func (*RandomTreeNode) InsertInOrder

func (root *RandomTreeNode) InsertInOrder(value int)

Jump to

Keyboard shortcuts

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