Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- knakul853
- */
- void goleft(node* root){
- if(root == NULL) return;
- goleft(root->left);
- cout<<root->data<<" ";
- }
- void goright(node * root){
- if(root == NULL){
- return;
- }
- cout<<root->data<<" ";
- goright(root->right);
- }
- void topView(node * root) {
- node * p =root;
- node * q =root;
- if(root==NULL)return;
- if(p->left != NULL){
- goleft(p->left);
- }
- cout<<root->data<<" ";
- if(q->right != NULL)
- goright(q->right);
- }
Add Comment
Please, Sign In to add comment