问题:一个数应该插入到有序数组的哪个位置class Solution {public: int searchInsert(int A[], int n, int target) { int i; for(i=0;i<n;i++) if(target<=A[i]) b...
分类:
其他好文 时间:
2014-08-01 22:57:22
阅读次数:
204
题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.题解:之前做过一道是从sorted array转换到BinarySearc....
分类:
编程语言 时间:
2014-08-01 04:54:21
阅读次数:
310
题目: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return....
分类:
编程语言 时间:
2014-08-01 04:53:31
阅读次数:
279
题目:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique B....
分类:
编程语言 时间:
2014-08-01 04:53:11
阅读次数:
272
题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "ad....
分类:
编程语言 时间:
2014-08-01 02:20:41
阅读次数:
236
This assignment will help you practice and understand better the Binary Tree and Binary Search Tree data structures, their operations and implementati...
分类:
编程语言 时间:
2014-07-31 23:20:10
阅读次数:
270
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.算法:根据有序数组,生...
分类:
其他好文 时间:
2014-07-31 23:20:00
阅读次数:
270
1.首先要安装编译源码用的编译器gcc&g++,安装方式很简单,先用yum search gcc搜索出包,然后选择适合自己的版本复制全名,用yum intall gcc_XXX来进行安装即可。2.安装openssl以及ncurses-devel。安装方式和1一样。3.从这里http://www.er...
分类:
其他好文 时间:
2014-07-31 23:18:20
阅读次数:
254
Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol...
分类:
其他好文 时间:
2014-07-31 23:13:00
阅读次数:
223
Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre...
分类:
其他好文 时间:
2014-07-31 23:11:40
阅读次数:
225