Given a binary tree, print it vertically. The following example illustrates vertical order traversal. 1 / \ 2 3 / \ / \ 4 5 6 7 \ \ 8 9The output of p...
分类:
其他好文 时间:
2014-11-08 19:29:26
阅读次数:
212
Lua学习笔记之函数
1、 函数的作用
函数主要完成指定的任务,这样的情况下函数作为调用语句使用,函数可以计算并返回值,这样的情况下函数作为赋值语句的表达式使用。
语法:
funcationfunc_name(arguments-list)
Statements-list
end
调用函数的时候,如果参数列表为空,必须使用()表示是函数调用。
Print(8*9,9/8)
a ...
分类:
其他好文 时间:
2014-11-08 18:20:26
阅读次数:
168
如果按照下面方式,则无论你输入什么,都会打印12,因为raw_input接受的输入是按照字符串处理的num = raw_input('please enter a num:')if num > 10: print 12else: print -abs(int(num))需要改成下面的写法...
分类:
编程语言 时间:
2014-11-08 18:11:46
阅读次数:
251
#include #include #include #include using namespace std;void print(vector &v) { int len = v.size(); for (int i=0; i C(NC); for (int i=0; i P(...
分类:
其他好文 时间:
2014-11-08 16:31:30
阅读次数:
133
算术运算符及代码:public class Test{public static void main(String []args){int i1 = 10;int i2 = 20;int i = 0;i = i1++;System.out.print("i = " + i);System.out.p...
分类:
其他好文 时间:
2014-11-08 00:46:05
阅读次数:
210
#Python字符串操作'''1.复制字符串'''#strcpy(sStr1,sStr2)sStr1 = 'strcpy'sStr2 = sStr1sStr1 = 'strcpy2'print sStr2'''2.连接字符串'''#strcat(sStr1,sStr2)sStr1 = 'strcat...
分类:
编程语言 时间:
2014-11-07 11:04:09
阅读次数:
227
主方法必须有几下几点,缺一不可:1.访问控制符为public2.必须为静态方法,须有static修饰3.返回类型为void4.方法参数为string类型的数组,数组名任意但必须满足标示符规范。==========一下定义的main()方法,都是正确的==========//1.默认 public s...
分类:
其他好文 时间:
2014-11-07 09:49:46
阅读次数:
197
今天想写一个邮件的解析文件,看书上有这么一段代码,源代码大致如下:importsys,email
mailFile=open(‘./ReceivedHeader.txt‘,‘r‘)
#mail载入并存入内存并解析它
#msg=email.message_from_file(sys.stdin)
msg=email.message_from_file(mailFile)
#print"msg.items()function..
分类:
编程语言 时间:
2014-11-07 06:27:06
阅读次数:
266
String[] str = new String[] { "a", "b", "c" }; System.out.println(str); System.out.println(str.toString());控制台输出结果如下:[Ljava.lang.String;@1db9742[Lj...
分类:
其他好文 时间:
2014-11-06 23:29:44
阅读次数:
329
获取时间 >>>?import?time
>>>?ticks=time.time()
>>>?print(ticks)
1415277557.990928
>>>?localtime=time.localtime(ticks)
>>>?print(localtime)
time.struct_time(tm_year=2014,?tm_mon=11,?tm_mday...
分类:
其他好文 时间:
2014-11-06 22:09:21
阅读次数:
236