*Using Stack : *

j = 0;

for ( int i = 0; i < prefix.len(); i++ ) {
        if ( isOperator(prefix[i]) ) stk.push(prefix[i]);
        else {
                   postfix[j] = prefix[i];
                   j++;

                   while ( !stk.empty() && stk.top == '#' ) {
                           stk.pop();
                           postfix[j] = stk.top();
                           j++;
                           stk.pop();
                   }

                   stk.push('#');
        }
}

-- 


Akshat Sapra
Under Graduation(B.Tech)
IIIT-Allahabad(Amethi Campus)
*--------------------------------------*
sapraaks...@gmail.com
akshatsapr...@gmail.com
rit20009008@ <rit20009...@gmail.com>iiita.ac.in

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to