You are viewing a single comment's thread. Return to all comments →
Simple version.
void top_view(node* root, int order = 0) { if (root == NULL) return; if (order <= 0) top_view(root->left, -1); cout << root->data << " "; if (order >= 0) top_view(root->right, 1); }
Tree : Top View
You are viewing a single comment's thread. Return to all comments →
Simple version.