yum -y install wget#yum install perlSearching for GCC...The path "" is not valid path to the gcc binary.Would you like to change it? [yes]如果出现这个就表明gcc...
分类:
其他好文 时间:
2015-12-26 18:28:10
阅读次数:
13771
问题:给定一个已排序数组和一个整数,若整数已在数组中则返回在数组中的下标,否则返回应当插入的位置。 对一个已排序数组进行搜索,很自然地会想到二分搜索(Binary Search),毕竟是经典场景。这道题也确实是二分搜索的一个简单应用。 之所以记录这道题目,是感觉二分搜索和之前做的 双指针法 tw...
分类:
其他好文 时间:
2015-12-26 13:25:26
阅读次数:
143
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-12-25 20:59:38
阅读次数:
167
题目描述:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipe...
分类:
编程语言 时间:
2015-12-25 18:43:50
阅读次数:
140
感觉我这个思路好 先记录上一层有几个节点/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * Tre...
分类:
其他好文 时间:
2015-12-25 14:56:34
阅读次数:
125
Invert a binary tree 翻转一棵二叉树假设有如下一棵二叉树: 4 / \ 2 7 / \ / \1 3 6 9翻转后: 4 / \ 7 2 / \ / \ 9 6 3 1这里采用递归的方法来处理。遍历结点,将每个结点的两个子结点交换位置即...
分类:
其他好文 时间:
2015-12-25 01:07:11
阅读次数:
150
Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target.Note:Given target value is a floating...
分类:
其他好文 时间:
2015-12-24 14:38:10
阅读次数:
174
Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target.Note:Given target value is a floating...
分类:
其他好文 时间:
2015-12-24 10:30:24
阅读次数:
128
根据 arraylist 的size和level比较, 从而每层bst只放一个元素public class Solution { public List rightSideView(TreeNode root) { List res = new ArrayList(); ...
分类:
其他好文 时间:
2015-12-24 07:04:09
阅读次数:
190
The order of a TreeProblem DescriptionThe shape of a binary search tree is greatly related to the order of keys we insert. To be precisely:1.insert a ...
分类:
编程语言 时间:
2015-12-23 21:01:44
阅读次数:
226