tree

package
v0.0.0-...-f750034 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Levels

func Levels(root *TreeNode) []int

总结 广度优先遍历 层遍历: 队列 Levels 二叉树的层序遍历

func NewMaxHeap

func NewMaxHeap(nums []any) *maxHeap

refer: https://www.hello-algo.com/chapter_heap/build_heap/

构造方法,根据切片建堆,已有元素存储在切片中
* 时间复杂度: O(n)

Types

type TreeNode

type TreeNode struct {
	Val    int
	Height int // 节点高度,AVL 树需要使用的字段
	Left   *TreeNode
	Right  *TreeNode
	// contains filtered or unexported fields
}

树: 链表的表示

func NewTreeNode

func NewTreeNode(val int) *TreeNode

Jump to

Keyboard shortcuts

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