摘要: Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it. Not 阅读全文
posted @ 2016-08-09 10:18 北叶青藤 阅读(271) 评论(0) 推荐(0)
摘要: For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible roote 阅读全文
posted @ 2016-08-09 09:17 北叶青藤 阅读(221) 评论(0) 推荐(0)
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2016-08-09 03:59 北叶青藤 阅读(293) 评论(0) 推荐(0)
摘要: Union-Find Algrithm is used to check whether two components are connected or not. Examples: By using the graph, we can easily find whether two compone 阅读全文
posted @ 2016-08-09 02:25 北叶青藤 阅读(633) 评论(0) 推荐(0)