runtime

package
v0.0.0-...-53d1e4d Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinarySearchTree

type BinarySearchTree struct {
}

func NewBinarySearchTree

func NewBinarySearchTree() BinarySearchTree

func (*BinarySearchTree) BuildFromPreorder

func (this *BinarySearchTree) BuildFromPreorder(preorder []int) *TreeNode

type BinaryTree

type BinaryTree struct {
}

func NewBinaryTree

func NewBinaryTree() BinaryTree

func (*BinaryTree) DisplayLevelOrder1

func (bt *BinaryTree) DisplayLevelOrder1(root *TreeNode) [][]int

DisplayLevelOrder1 /*

层序遍历顺序为:每一层从左到右

func (*BinaryTree) DisplayLevelOrder2

func (bt *BinaryTree) DisplayLevelOrder2(root *TreeNode) [][]int

DisplayLevelOrder2 /*

层序遍历顺序为:每一层从左到右

解题思路: 1、初始化临时队列,将根节点入队 2、遍历临时队列,每次出队一个节点,获取当前节点值,并将当前节点左右叶子节点依次压入临时队列 3、当临时队列不为空时,循环1、2步

type DLinkedList

type DLinkedList struct {
	// contains filtered or unexported fields
}

func NewDLinkedList

func NewDLinkedList() DLinkedList

func (*DLinkedList) AddAtHead

func (this *DLinkedList) AddAtHead(val int)

func (*DLinkedList) AddAtIndex

func (this *DLinkedList) AddAtIndex(index int, val int)

func (*DLinkedList) AddAtTail

func (this *DLinkedList) AddAtTail(val int)

func (*DLinkedList) DeleteAtIndex

func (this *DLinkedList) DeleteAtIndex(index int)

func (*DLinkedList) Display

func (this *DLinkedList) Display()

func (*DLinkedList) Get

func (this *DLinkedList) Get(index int) int

type DListNode

type DListNode struct {
	Val  int
	Prev *DListNode
	Next *DListNode
}

type LinkedList

type LinkedList struct {
	// contains filtered or unexported fields
}

func NewLinkedList

func NewLinkedList() LinkedList

func (*LinkedList) AddAtHead

func (this *LinkedList) AddAtHead(val int)

func (*LinkedList) AddAtIndex

func (this *LinkedList) AddAtIndex(index int, val int)

func (*LinkedList) AddAtTail

func (this *LinkedList) AddAtTail(val int)

func (*LinkedList) DeleteAtIndex

func (this *LinkedList) DeleteAtIndex(index int)

func (*LinkedList) Display

func (this *LinkedList) Display()

func (*LinkedList) Get

func (this *LinkedList) Get(index int) int

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

type MaxHeap

type MaxHeap struct {
	sort.IntSlice
}

func NewMaxHeap

func NewMaxHeap(nums []int) *MaxHeap

func (*MaxHeap) Less

func (this *MaxHeap) Less(i, j int) bool

func (*MaxHeap) Pop

func (this *MaxHeap) Pop() interface{}

func (*MaxHeap) Push

func (this *MaxHeap) Push(val interface{})

type MaxPriorityQueue

type MaxPriorityQueue struct {
	// contains filtered or unexported fields
}

func NewMaxPriorityQueue

func NewMaxPriorityQueue(nums []int) MaxPriorityQueue

func (*MaxPriorityQueue) Display

func (this *MaxPriorityQueue) Display()

func (*MaxPriorityQueue) Pop

func (this *MaxPriorityQueue) Pop() int

func (*MaxPriorityQueue) Push

func (this *MaxPriorityQueue) Push(val int)

type MinHeap

type MinHeap struct {
	sort.IntSlice
}

func NewMinHeap

func NewMinHeap(nums []int) *MinHeap

func (*MinHeap) Less

func (this *MinHeap) Less(i, j int) bool

func (*MinHeap) Pop

func (this *MinHeap) Pop() interface{}

func (*MinHeap) Push

func (this *MinHeap) Push(val interface{})

type Node

type Node struct {
	Val    int
	Parent *Node
	Left   *Node
	Right  *Node
	Next   *Node
}

type TreeNode

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

Jump to

Keyboard shortcuts

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