Which data structure is needed to convert infix notations to pre fix notations?

1 answer

Answer

1097336

2026-04-24 09:10

+ Follow

S: Stack

while(more tokens)

{

x<-next token;

if(x is an operand)

print x

else

{

while(precedence(x) <= precedence(top(s))

print(pop(s))

push(s,x)

}

}

while(!empty(s))

print(pop(s));

Written by: Fabianski Benjamin

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.