Guest User

Untitled

a guest
Apr 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5. const int N=15;
  6. int tab[N]={5,2,7,0,0,1,4,0,3,8,10,11,9,0,0};
  7. void wyswietl()
  8. {
  9. for(int i=0;i<15;i++)
  10. cout << tab[i] << endl;
  11. }
  12.  
  13. void preorder(int i)
  14. {
  15. if( tab[i]!=0 && i<=N )
  16. {
  17. cout<<tab[i]<<" ";
  18. preorder(2*i+1);
  19. preorder(2*i+2);
  20. }
  21. }
  22.  
  23.  
  24. int main()
  25. {
  26. wyswietl();
  27. preorder(0);
  28. system("PAUSE");
  29. return EXIT_SUCCESS;
  30. }
Add Comment
Please, Sign In to add comment