Can any one help me in providing help
I am working on Tree Structure
My problem is to take input as an expression like a+b(c/t) and
Using Binary Tree converting it into postfix RPN ab+ct/
Can any one help me in providing help
I am working on Tree Structure
My problem is to take input as an expression like a+b(c/t) and
Using Binary Tree converting it into postfix RPN ab+ct/
Jump to PostIt's pretty simple first create a binary tree, then read the input and insert each element in appropriate place in teh tree, then read it back in postfix notation.
Let us know once you're done with the code if you need more help.
It's pretty simple first create a binary tree, then read the input and insert each element in appropriate place in teh tree, then read it back in postfix notation.
Let us know once you're done with the code if you need more help.
>It's pretty simple first create a binary tree, then read the input and insert
>each element in appropriate place in teh tree, then read it back in postfix notation.
Brilliant. :)
It isn't actually that difficult.
Find the operator with the lowest priority, store it as the root node with the left and right expressions as subnodes.
Repeat for both subnodes.
One thing that complicates it a little is characters that can act as both unary and binary operators (-).
Personally, I find using the stack much easier to complete such a task. Look here for ideas.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.