2 votes 2 votes What is time complexity to evaluate prefix and postfix expression ? as per me it should be O(n) as atmost 2 pop operation perform and 1 push operation saurav04 asked Nov 25, 2015 • recategorized Dec 4, 2015 by Pooja Palod saurav04 1.6k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes It will be O(m*n),. m : size of largest subpart. n : total size http://stackoverflow.com/questions/13302402/infix-to-prefix-time-and-space-complexity#comment18141208_13302402 Digvijay Pandey answered Nov 25, 2015 Digvijay Pandey comment Share Follow See 1 comment See all 1 1 comment reply hkara657 commented Jan 7, 2016 reply Follow Share but here complexity of evaluating the prefix expression is asked and not the complexity of infix to prefix conversion is asked. (the link you mentioned doesn't answer the question) i also think it should be O(n) but given it's O(n^2). 1 votes 1 votes Please log in or register to add a comment.