python实现二叉树的中序遍历

#!/usr/bin/env python

# coding=utf-8

# inorderbl.py

import stdininput

def inorder(arrays,arraysize,currentp):

if(2*currentp+1

inorder(arrays,arraysize,2*currentp+1)

print arrays[currentp]

if(2*currentp+2

inorder(arrays,arraysize,2*currentp+2)

if __name__==’__main__’:

stdininput.stdininput()

inorder(stdininput.intsortarrays,len(stdininput.intsortarrays),0)

Posted in 未分类

发表评论