void inorder(Node* root) {
if (root == NULL) return; // ✅ base case handled
inorder(root->left); // 🡐 left
cout << root->data << endl; // 🡐 root
inorder(root->right); // 🡐 right
}
#include <iostream> using namespace std; struct Node { int data; Node* next; }; class Stack { Node* top; public: Stac...
No comments:
Post a Comment