No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
4 Posted Topics
the compiler compile the code,but traversing output is wrong .please chech ny logic is correct,tell me best tutorial to learn of binary tree using stack . void usman:: inorder() { stack<node*>s; node *t=root; while(!s.empty()||t!=NULL) { if(t!=NULL) { s.push(t); t=t->left; } else { t=s.top(); s.pop(); cout<<t->data<<","; t=t->right; } } }
#include<iostream> #include<conio.h> #include<string.h> #define size 50 //minimum input 50 using namespace std; int main() { int i=0;; string names[size];//store input string names_dis[size];//save input condition fullfill do { cout<<"Enter name"<<i+1<<"::"<<endl; cin>>names[i]; if(names[i]!="end"&&names[i].length()<=25&&names[i].length()>10) { names_dis[i]=names[i]; } i++; } while(names[i-1]!="end"); for(int j=0;j<i;j++) { cout<<names_dis[j]<<endl; } getch(); }
#include<iostream> #include<stack> using namespace std; struct node #include<iostream> #include<stack> using namespace std; struct node { int data; node *left; node *right; }; class usman { private: node *root,*leaf; int count; public: usman(); //~usman(); bool input(); void call(); void preorder(); void postorder(); }; usman::usman() { root=leaf=NULL; count=0; } bool usman::input() { …
hy ,i make binary tree,the input of binary tree in correct.but issues traversing of binary tree using stack ,because the result of traversing is wrong .please solve this issues. #include<iostream> #include<stack> using namespace std; struct node { int data; node *left; node *right; }; class usman { private: node *root,*leaf; …
The End.
Usman_9