+ Start a Discussion
ips007ips007 

Prefix expression evaluation

Hi,

I want to evaluate my prefix expression. For this I am using logic in which

1. I reversed the expression, (on reverse it's not converted to post fix)

2. And then evaluating this reversed expression using stack.

 

Is my logic correct?

Will this cause any error / invalid evaluation?

 

Thanks in advance... :)

goabhigogoabhigo

Can you elaborate? Your question is not clear.

ipsips

Hi Abhi,

Please, find following link for Prefix evaluation method:

http://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29#Evaluation_of_Prefix_Expression

 

For simple expression its evaluates correctly. But,I am not sure about the method for complex scenarios( many nested operations in expression) .

Will this cause any error / invalid evaluation?

 

Thanks...