Is it worth parsing an infix algebraic expression to postfix and then an expression tree?

by JulianSoto   Last Updated November 15, 2017 04:05 AM

I am trying to make a simple expression parser, in which users type an expression in infix notation (for example ln((1+2)(3-4))) to apply some calculations. To make this possible I need to tokenize the expression as a expression tree. I've read in blogs and forum that I need first to convert the expression to postfix (or similar notations) and then convert the postfixed expression to a tree. Is there any advantage in doing this? Why cannot I simply convert the infix expression to a binary tree? Is there any performance improvement? I think parsing two times an algebraic expression is a waste of CPU cycles, am I wrong?

Related Questions

How to find siblings of a tree?

Updated August 23, 2015 19:02 PM

Binary Tree children count of a node

Updated April 23, 2016 08:02 AM

How do binary trees use memory to store its data?

Updated July 02, 2015 13:02 PM

BST to AVL in O(n)

Updated April 14, 2016 08:02 AM