摘要:
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's ... 阅读全文
posted @ 2015-08-14 16:24
尾巴草
阅读(150)
评论(0)
推荐(0)
摘要:
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia:... 阅读全文
posted @ 2015-08-14 15:26
尾巴草
阅读(332)
评论(0)
推荐(0)
摘要:
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by thi... 阅读全文
posted @ 2015-08-14 14:49
尾巴草
阅读(152)
评论(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 @ 2015-08-14 11:29
尾巴草
阅读(129)
评论(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 @ 2015-08-14 10:46
尾巴草
阅读(174)
评论(0)
推荐(0)

浙公网安备 33010602011771号