1 # include<iostream> 2 # include<cstdio> 3 using namespace std; 4 int inorder(int i,int j) 5 { 6 if(i<=j) 7 printf("%d ",i); 8 if(2*i<=j) 9 inorder(2*i,j); 10 if(2*i+1<=j) 11 inorder(2*i+1,j); 12 return 1; 13 } 14 int main() 15 { 16 inorder(1,5); 17 }
View Code