摘要: 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 阅读全文
posted @ 2016-05-04 19:24 Black_Knight 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its ne 阅读全文
posted @ 2016-05-04 17:52 Black_Knight 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 把一个有序的数组转换为一颗平衡二叉搜索树。每次找到中间节点作为根节点,根节点左边部分转换为左子树,右边部 阅读全文
posted @ 2016-05-04 17:18 Black_Knight 阅读(171) 评论(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. 通过树的中序序列和前序序列 阅读全文
posted @ 2016-05-04 15:39 Black_Knight 阅读(294) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2016-05-04 11:17 Black_Knight 阅读(219) 评论(0) 推荐(0) 编辑