Hi james, can you please correct me .

Thank you in avdvance.


Sorry, I won't do your homework for youb I will help you do it if you're prepared to put in some brainpower.

If you want to store Strings like "20" in your BST then the data field needs to be a String not a char, then that code you have extracting chars from the String isn't needed...

Edited by JamesCherrill


How will you handle on this?

bsto.Insert(new String("5*20"));

how do i extract those elements in the strings if i will not convert it char ?

You need to parse that into "5" "*" "20"
for that you will need to look at one char at at time, but the numbers need to be put back together.


Is this what you mean


Hi james, but i want the user's to input the infix.I don't want to make it static


I don't know how to do with the operators...if i will input like this 2*5/9




Step 1: Parse infix into BST recursively.
Step 2: Write BST in postfix notation.


If i will input infix 5*3/9,in your step 1 what should i do to the operators?..if 5 is the root what will i do to the next element which is * where should i will insert this in right or left of the root?

Edited by toring


It's not hard to test each char to see if it's a numeric or an operator,yes we can use the Character.isDigit,but what i my question what should i do if i meet operators where do i insert this.


I have no idea if i encounter operator what should i do?how do i insert this to the tree?

Thank you in advance.


@Hiroshe,what if there is -,+,or lets say 5-9*6/3+2

Thank you in advance

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.