You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-05-23 07:43:23
阅读次数:
246
首先一个简单的问题,如何实现交换两个整数的值? 想必每个有编程经验的人都能作答。
C语言用指针实现如下:
void swap(int * a, int * b){
int tmp = *a;
*a = *b;
*b = tmp;
}
C++可以使用引用实现如下:
void swap(int & a, int & b){
int tmp = a;
a ...
分类:
编程语言 时间:
2014-05-22 13:45:35
阅读次数:
286
问题
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorde...
分类:
其他好文 时间:
2014-05-22 07:04:46
阅读次数:
298
Given a linked list and a valuex, partition it
such that all nodes less thanxcome before nodes greater than or equal tox.You
should preserve the origi...
分类:
其他好文 时间:
2014-05-22 03:53:29
阅读次数:
313
Find common nodes of 2 linked list.
分类:
其他好文 时间:
2014-05-22 00:10:17
阅读次数:
241
一:字符替换:strtr > str_replace >
preg_replace注意:1:一般用strtr函数的这种形式:string strtr ( string $str , array
$replace_pairs )2:如果 replace_pairs 中包含一个空 字符串 (...
分类:
Web程序 时间:
2014-05-21 23:40:35
阅读次数:
357
Problem Description
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the follow...
分类:
其他好文 时间:
2014-05-21 10:55:57
阅读次数:
325
一.硬件资源内存:1G以上SWAP空间:至少1.5G,要求为内存的2倍temp空间:400Mlinux的临时空间是/tmpwindows的临时空间如下:c:\>echo%homedrive%%homepath%\localsettings\temp硬盘空间:linux/unix需要1.3~3.5Gwindows需要1~1.5G二、OFA最佳灵活体系结构(目录命名)1、linu..
分类:
数据库 时间:
2014-05-20 18:45:21
阅读次数:
488
for i in [n+1 N] M=rand(1,i) if(M<=n) swap the
ith and Mth
data证明方法:1.初始情况,当尚未选择时,出现在pool中的n个元素的概率相同都是1,证明当第n+1葛元素以n/(n+1)的概率被选中时,前n个元素在pool中的概率为...
分类:
其他好文 时间:
2014-05-20 09:43:42
阅读次数:
294
戳我去解题Merge two sorted linked lists and return it as
a new list. The new list should be made by splicing together the nodes of the
first two lists.分析:直...
分类:
其他好文 时间:
2014-05-20 08:52:09
阅读次数:
277