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 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 MaxHeap ¶
func NewMaxHeap ¶
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 ¶
func NewMinHeap ¶
Click to show internal directories.
Click to hide internal directories.