摘要: 双层桶划分双层桶划分----其实本质上还是分而治之的思想,重在“分”的技巧上!适用范围:第k大,中位数,不重复或重复的数字基本原理及要点:因为元素范围很大,不能利用直接寻址表,所以通过多次划分,逐步确定范围,然后最后在一个可以接受的范围内进行。可以通过多次缩小,双层只是一个例子。扩展:问题实例:13... 阅读全文
posted @ 2015-08-12 15:41 Chapter 阅读(200) 评论(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 on... 阅读全文
posted @ 2015-08-12 10:43 Chapter 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Problem I: Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in... 阅读全文
posted @ 2015-08-12 10:37 Chapter 阅读(166) 评论(0) 推荐(0) 编辑