Documentation
¶
Index ¶
- Constants
- func LeetcodeArrayStringToArray(array string) []string
- func Max[T lancetconstraints.Number](a, b T) T
- func Repeat(in string, count int) string
- func Str2Int(strs []string) ([]int, error)
- func Tree2InOrder(root *TreeNode) []string
- func Tree2PostOrder(root *TreeNode) []string
- func Tree2PreOrder(root *TreeNode) []string
- func Tree2Strs(root *TreeNode) []string
- func TreeSource(root *TreeNode) []string
- type TreeNode
Constants ¶
View Source
const (
NullNode = "null" // 空节点
)
Variables ¶
This section is empty.
Functions ¶
func LeetcodeArrayStringToArray ¶
Leetcode 代码样例中给的字符串转数组 [0,null,1] => []string{"0", "null", "1"}
func Tree2InOrder ¶
Inorder traversal of binary tree 中序遍历,左右根
func Tree2PostOrder ¶
Postorder traversal of binary tree 后序遍历,左右根
func Tree2PreOrder ¶
Preorder traversal of binary tree 前序遍历,根左右
func TreeSource ¶
由数组构建二叉树,数组是程序遍历的二叉树 如 1_1
/ \ 3_2 2_3 / \ \ 5_4 3_5 9_7
为[1,3,2,5,3,null,9] i*2 i*2+1
0,1,2,3,4, 5, 6
Types ¶
type TreeNode ¶
func NewTreeNode ¶
func Strs2TreeNode ¶
字符串数组转二叉树 references:git@github.com:halfrost/LeetCode-Go.git
func (*TreeNode) PrintHorizontally ¶
display tree like this: * BinaryTree * │ ┌── 6 * │ ┌── 5 * │ ┌── 4 * │ │ └── 3 * └── 2 * └── 1
func (*TreeNode) PrintVertically ¶
references:https://stackoverflow.com/questions/4965335/how-to-print-binary-tree-diagram-in-java * print tree like this: * 0 * / \ * 1 2
Click to show internal directories.
Click to hide internal directories.