摘要: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n ) space 阅读全文
posted @ 2017-06-13 21:39 王大咩的图书馆 阅读(295) 评论(0) 推荐(0) 编辑
摘要: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should return all 阅读全文
posted @ 2017-06-13 20:25 王大咩的图书馆 阅读(352) 评论(0) 推荐(0) 编辑
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2017-06-13 17:12 王大咩的图书馆 阅读(2786) 评论(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 @ 2017-06-13 15:53 王大咩的图书馆 阅读(358) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文
posted @ 2017-06-13 10:46 王大咩的图书馆 阅读(352) 评论(0) 推荐(0) 编辑