文件名称:leetcode-tree
文件大小:17KB
文件格式:ZIP
更新时间:2024-05-09 04:05:12
C++
二叉树的遍历 前中后序,递归和非递归算法 非递归算法:用stack辅助,出栈时机不一样,相当于深搜。 144-Binary Tree Preorder Traversal 94-Binary Tree Inorder Traversal 145-Binary Tree Postorder Traversal(后续的非递归时间不够可以先跳过,有点难) 层次遍历,队列辅助,相当于广搜。 102-Binary Tree Level Order Traversal 199-Binary Tree Right Side View:层次遍历的一个运用 树的构造 给出前中后序的序列中的两个,构造一棵树。递归。 前序 parent left-child right-child 中序 left-child parent right-child 后续 left-child right-child parent
【文件预览】:
leetcode-tree-master
----104-Maximum-Depth-of-Binary-Tree.cpp(2KB)
----144-Binary-Tree-Preorder-Traversal.go(889B)
----94-Binary-Tree-Inorder-Traversal.go(625B)
----README.md(2KB)
----617-Merge-Two-Binary-Trees.cpp(293B)
----114-Flatten-Binary-Tree-to-Linked-List.go(1KB)
----108-Convert-Sorted-Array-to-Binary-Search-Tree.go(2KB)
----100-Same-Tree.go(562B)
----226-Invert-Binary-Tree.go(439B)
----145-Binary-Tree-Postorder-Traversal.cpp(2KB)
----106-Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.cpp(2KB)
----889-Construct-Binary-Tree-from-Preorder-and-Postorder-Traversal.cpp(2KB)
----105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.cpp(2KB)
----101-Symmetric-Tree.go(518B)
----1008-Construct-Binary-Search-Tree-from-Preorder-Traversal.cpp(1KB)
----235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.go(2KB)
----94-Binary-Tree-Inorder-Traversal.cpp(1KB)
----110-Balanced-Binary-Tree.go(963B)
----102-Binary-Tree-Level-Order-Traversal.cpp(1KB)
----105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.go(731B)
----145-Binary-Tree-Postorder-Traversal.c(324B)
----144-Binary-Tree-Preorder-Traversal.cpp(1KB)
----102-Binary-Tree-Level-Order-Traversal.go(830B)
----617-Merge-Two-Binary-Trees.go(894B)
----654-Maximum-Binary-Tree.go(646B)
----96-Unique-Binary-Search-Trees.go(476B)
----226-Invert-Binary-Tree.cpp(724B)
----199-Binary-Tree-Right-Side-View.go(799B)