Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- const int N=15;
- int tab[N]={5,2,7,0,0,1,4,0,3,8,10,11,9,0,0};
- void wyswietl()
- {
- for(int i=0;i<15;i++)
- cout << tab[i] << endl;
- }
- void preorder(int i)
- {
- if( tab[i]!=0 && i<=N )
- {
- cout<<tab[i]<<" ";
- preorder(2*i+1);
- preorder(2*i+2);
- }
- }
- int main()
- {
- wyswietl();
- preorder(0);
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Add Comment
Please, Sign In to add comment