#coding=gbk'''Created on 2014-5-7'''import os.pathinputPath = './input.txt'outPath = './out.txt'bufferSize = 10inputFile = open(inputPath, 'rb')outFil...
分类:
编程语言 时间:
2014-07-18 20:34:41
阅读次数:
246
class BTNode:
def __init__(self, val):
self.left = None
self.right = None
self.val = val
'''
@ construct tree by inorder & preorder
'''
def constructByInPre(inorder, instart, inend, preorde...
分类:
其他好文 时间:
2014-07-06 00:34:00
阅读次数:
234
#BintoDec
#myfirstpythonprograme
n=c=itm=0
a=raw_input(‘pleaseinputBinarynumber:\n‘)
forninrange(0,len(a)):
b=a[n:n+1]
#print‘nis‘,n
#print‘bis‘,b
#print‘len‘,len(a[n:])
ifb==‘1‘:
c=2**(len(a[n:])-1)
#print‘c1is‘,c
else:
c=0
#print‘cis0‘
itm=c+itm
#print‘it..
分类:
编程语言 时间:
2014-07-01 09:35:48
阅读次数:
226
二叉树的插入与删除,来自Mark Allen Weiss的《数据结构与算法分析》。# Definition for a binary tree nodeclass TreeNode: def __init__(self, x): self.val = x self...
分类:
编程语言 时间:
2014-06-17 14:25:01
阅读次数:
291
Python一维数组初始化:>>> list=[]>>>
type(list)>>> list[]Python二维数组初始化:>>> lists = [[]] *
3>>> lists[[], [], []]>>> lists[0].append(3)>>>
lists[[3], [3], [3]]...
分类:
编程语言 时间:
2014-06-07 23:49:56
阅读次数:
563
python创建二叉树,源代码如下:
#!/usr/bin/python
class node():
def __init__(self,k=None,l=None,r=None):
self.key=k;
self.left=l;
self.right=r;
def create(root):
a=raw_input('enter a key:');
if a is '#...
分类:
编程语言 时间:
2014-05-18 09:27:13
阅读次数:
384
写在前面:
Why to learn Python?All in picture:
开始正文啦,本文截取了笔记中的部分,其他详细内容稍微会整理呈现在博客中...
本文解决以下问题:
一、什么是Python
二、配置Windows Python环境
三、配置Python的Eclipse开发环境
四、Hello World,Python,waiting f...
分类:
编程语言 时间:
2014-04-28 10:12:41
阅读次数:
400