Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Not...
分类:
其他好文 时间:
2014-09-13 20:06:25
阅读次数:
173
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. 1 /** 2 ...
分类:
其他好文 时间:
2014-09-13 20:03:15
阅读次数:
228
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:
其他好文 时间:
2014-09-13 20:01:35
阅读次数:
185
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 ...
分类:
其他好文 时间:
2014-09-13 20:00:35
阅读次数:
207
闲来无事,想起上学时数据结构课程中有个字符串位移的小算法挺有意思,今天写了下,就测试了一个字符串,纯属娱乐。public class Offset { public static void swap(char [] chars , int position1 , int position2){ .....
分类:
其他好文 时间:
2014-09-13 14:38:35
阅读次数:
143
利用两个队列(或vector):curlevel和nextlvevl分别表示当前层的所有可能状态和转换到的下一层的所有可能状态。我们的目标是转换到end单词即可,深搜会超时。使用广搜,各层的可能结点同时向下进行,找到end即可return。当找完当前层的所有可能结点后,当前层也就空了,然后swap(...
分类:
其他好文 时间:
2014-09-13 12:02:15
阅读次数:
196
在Doug Lea提供的cucurenct包(J.U.C)中,CAS理论是实现整个java包的基石。Compare and Swap在这里,CAS 指的是现代 CPU 广泛支持的一种对内存中的共享数据进行操作的一种特殊指令。这个指令会对内存中的共享数据做原子的读写操作。简单介绍一下这个指令的操作过程...
分类:
编程语言 时间:
2014-09-12 23:18:24
阅读次数:
330
在2g内存的台式机里安装了三台虚拟机,跑起来好可以,就是swap用的比较多,图见上一篇随笔。现在平台基本有了,自己笔记本算总控,实验室台式机跑着4台机器(一实三虚),加上一台服务器,可以做很多事情了,由于kvm是桥接网络,三虚跟一实地位一致,在校园网内都含有自己的ipv4,ipv6地址。ipv4.....
分类:
其他好文 时间:
2014-09-12 18:41:44
阅读次数:
355
题目:输入三个整数x,y,z,请把这三个数由小到大输出。def swap(a,b): t=a; a=b; b=t; return (a,b);def foo(x,y,z): if x>y: (x,y)=swap(x,y) if x>z: ...
分类:
编程语言 时间:
2014-09-12 17:03:33
阅读次数:
195
先看看官方手册的说明吧:
pairs (t)If t has a metamethod __pairs, calls it with t as argument and returns the first three results from the call.
Otherwise, returns three values: the next function, the table t, a...
分类:
其他好文 时间:
2014-09-12 01:16:42
阅读次数:
304