摘要:
One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, 阅读全文
posted @ 2016-04-21 19:20
ArgenBarbie
阅读(257)
评论(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-04-21 19:04
ArgenBarbie
阅读(405)
评论(0)
推荐(0)
摘要:
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2016-04-21 17:41
ArgenBarbie
阅读(204)
评论(0)
推荐(0)
摘要:
235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the 阅读全文
posted @ 2016-04-21 16:04
ArgenBarbie
阅读(200)
评论(0)
推荐(0)
摘要:
Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex 阅读全文
posted @ 2016-04-21 15:30
ArgenBarbie
阅读(157)
评论(0)
推荐(0)
摘要:
Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 阅读全文
posted @ 2016-04-21 14:52
ArgenBarbie
阅读(178)
评论(0)
推荐(0)
摘要:
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2016-04-21 13:11
ArgenBarbie
阅读(125)
评论(0)
推荐(0)
摘要:
Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in th 阅读全文
posted @ 2016-04-21 11:15
ArgenBarbie
阅读(170)
评论(0)
推荐(0)
摘要:
Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: If you notice carefully in the flatt 阅读全文
posted @ 2016-04-21 10:53
ArgenBarbie
阅读(174)
评论(0)
推荐(0)
摘要:
108. Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 109. 阅读全文
posted @ 2016-04-21 10:14
ArgenBarbie
阅读(171)
评论(0)
推荐(0)