Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSymmetricV1 ¶
始化时我们把根节点入队两次。每次提取两个结点并比较它们的值 (队列中每两个连续的结点应该是相等的,而且它们的子树互为镜像) 然后将两个结点的左右子结点按相反的顺序插入队列中。
func IsSymmetricV2 ¶
通过「同步移动」两个指针的方法来遍历这棵树,p 指针和 q 指针一开始都指向这棵树的根 随后 p 右移时,q 左移,p 左移时,q 右移 每次检查当前 p 和 q 节点的值是否相等,如果相等再判断左右子树是否对称。
func ZigzagLevelOrder ¶
Types ¶
type BSTIterator ¶
func (*BSTIterator) HasNext ¶
func (this *BSTIterator) HasNext() bool
func (*BSTIterator) Next ¶
func (this *BSTIterator) Next() int
Source Files
¶
- 101.isSymmetric.go
- 102.levelOrder.go
- 103.zigzagLevelOrder.go
- 104.maxDepth.go
- 105.buildTree.go
- 106.buildTree.go
- 112.path-sum.go
- 113.path-sum-ii.go
- 114.flatten-binary-tree-to-linked-list.go
- 116.populating-next-right-pointers-in-each-node.go
- 124.binary-tree-maximum-path-sum.go
- 129.sum-root-to-leaf-numbers.go
- 144.binary-tree-preorder-traversal.go
- 145.binary-tree-postorder-traversal.go
- 173.binary-search-tree-iterator.go
- 199.binary-tree-right-side-view.go
- 222.count-complete-tree-nodes.go
- 226.invert-binary-tree.go
- 230.kth-smallest-element-in-a-bst.go
- 235.lowest-common-ancestor-of-a-binary-search-tree.go
- 236.lowest-common-ancestor-of-a-binary-tree.go
- 297.serialize-and-deserialize-binary-tree.go
- 538.convert-bst-to-greater-tree.go
- 543.diameter-of-binary-tree.go
- 617.merge-two-binary-trees.go
- 94.inorderTraversal.go
- 98.isValidBST.go
- 99.recoverTree.go
- datastruct.go
- offer.26.shu-de-zi-jie-gou-lcof.go
Click to show internal directories.
Click to hide internal directories.