Home > Article > Backend Development > Python implements in-order traversal of a binary tree
#!/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)