Two elements of a binary search tree (BST) are
swapped by mistake.Recover the tree without changing its structure.Note:A
solution using O(n) space is ...
分类:
其他好文 时间:
2014-05-17 11:30:21
阅读次数:
247
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero....
分类:
其他好文 时间:
2014-05-16 01:34:36
阅读次数:
293
Spiral MatrixGiven a matrix ofmxnelements
(mrows,ncolumns), return all elements of the matrix in spiral order.For
example,Given the following matrix:[...
分类:
其他好文 时间:
2014-05-12 20:04:43
阅读次数:
268
Given an integern, generate a square matrix
filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should
return the following matri...
分类:
其他好文 时间:
2014-05-12 19:53:23
阅读次数:
332
Given a singly linked list where elements are
sorted in ascending order, convert it to a height balanced BST.1.
将LinkedList的值保存到一个数组中,转化成Convert Sorte...
分类:
其他好文 时间:
2014-05-12 05:53:09
阅读次数:
367
OSIP在定义多线程的时候,需要添加锁,如果没有使用到多线程,就没有使用到锁的功能。文件代码:osip_fifo.h/***Structureforreferencingafifo.*@varosip_fifo_t*/typedefstructosip_fifoosip_fifo_t;/***Structureforreferencingafifo.*@structosip_fifo*/structosip_fifo{#if..
分类:
编程语言 时间:
2014-05-10 04:10:53
阅读次数:
640
Given an array S of n integers, are there
elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the
array which gives the sum of ...
分类:
其他好文 时间:
2014-05-09 10:27:29
阅读次数:
449
原地归并。下面是AC代码: 1 public void merge(int A[], int m,
int B[], int n) { 2 3 int len = A.length; 4 //first copy m elements of A...
分类:
其他好文 时间:
2014-05-09 05:59:54
阅读次数:
297
1. Write a procedure count-list to count the
number of elements in a list1 (defun count-list (numbers)2 (if (null numbers) 03
(+ 1 (co...
分类:
其他好文 时间:
2014-05-09 05:41:41
阅读次数:
307
Given an array where elements are sorted in
ascending order, convert it to a height balanced BST./** * Definition for binary
tree * public class TreeN...
分类:
其他好文 时间:
2014-05-08 00:51:46
阅读次数:
430