
二叉树
attention!
新丰美酒斗十千,咸阳游侠多少年。相逢意气为君饮,系马高楼垂柳边。
展开
-
二叉树遍历(中序)(递归+非递归)
Binary Tree Inorder Traversal(二叉树中序遍历)Given a binary tree, return the inorder traversal of its nodes’ values.For example:Given binary tree{1,#,2,3},return[1,3,2].Note: Recursive solution is triv...原创 2018-12-14 23:06:00 · 436 阅读 · 0 评论 -
二叉树遍历(前序)(递归+非递归)
题目Binary Tree Preorder TraversalGiven a binary tree, return the preorder traversal of its nodes’ values.For example:Given binary tree{1,#,2,3},return[1,2,3].Note: Recursive solution is trivia...原创 2018-12-16 14:39:20 · 251 阅读 · 0 评论 -
Binary Tree Level Order Traversal(二叉树层序遍历-保存并返回结果集)
题目描述Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example:Given binary tree{3,9,20,#,#,15,7},return its level order trav...原创 2018-12-30 17:27:41 · 276 阅读 · 0 评论 -
Symmetric Tree(对称树)
题目描述Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric:But the following is not:Note:Bonus points if you co...原创 2019-01-05 12:57:18 · 366 阅读 · 0 评论 -
Path Sum(路径和)
题目描述Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree andsu...原创 2019-01-02 19:31:45 · 206 阅读 · 0 评论 -
binary tree level order traversal ii)(二叉树自下向上层序遍历)
题目描述Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree{3,9,20,#,#,15,7},...原创 2019-01-13 15:49:10 · 194 阅读 · 0 评论