摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2015-01-17 21:08 vincently 阅读(318) 评论(0) 推荐(0) 编辑
摘要: Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree. 1 /** 2 * De... 阅读全文
posted @ 2015-01-17 19:25 vincently 阅读(215) 评论(0) 推荐(0) 编辑
摘要: Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree. 1 /** 2 * Def... 阅读全文
posted @ 2015-01-17 15:47 vincently 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al... 阅读全文
posted @ 2015-01-17 13:10 vincently 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 首先定义二叉树的存储结构: 1 struct TreeNode {2 int val;3 TreeNode *left;4 TreeNode *right;5 6 TreeNode(int v, TreeNode* l = NULL, TreeNode *r = N... 阅读全文
posted @ 2015-01-17 11:23 vincently 阅读(2790) 评论(0) 推荐(0) 编辑