摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2015-07-17 18:31 朱传林 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.取中间的结点作为根结点即平衡二叉树/** * Definition for a binary tree n... 阅读全文
posted @ 2015-07-17 17:03 朱传林 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2015-07-17 16:46 朱传林 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1。目录map简介map的功能map的定义在map中添加元素查找并获取map中的元素从map中删除元素map对象的迭代遍历2。map简介map是一类关联式容器,它是模板类。关联的本质在于元素的值与某个特定的键相关联,而并非通过元素在数组中的位置类获取。它的特点是增加和删除节点对迭代器的影响很小,除了... 阅读全文
posted @ 2015-07-17 15:07 朱传林 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ... 阅读全文
posted @ 2015-07-17 10:03 朱传林 阅读(159) 评论(0) 推荐(0) 编辑