Can you pls help me in java program....
i want to make a java program for binary trees. ill ask for mathematical equation then the program will display the equation into binary tree, in pre-order and post-order.
[178 byte] By [
aghiea] at [2007-11-26 18:15:47]

Out Sourcing home work huh ;-)
A nice little project and I'm sure someone will be able to assist you. What are you having problems with?
> i want to make a java program for binary trees. ill
> ask for mathematical equation then the program will
> display the equation into binary tree, in pre-order
> and post-order.
I forgot wat all tat means... Tell me... I'll do ur home wrk ;-)
Give a example
i think pre-order is1 + 3will become+/\ 13correct me if i'm wrong.. or is this post-order? or am i on another planet? lolss
here's the example input for my topic...
example input..
((23x^2)+(14y^3))/((4x^2)-(3y+x))
the program will show this:
pre-order
- + * 23 ^ x 2 * 14 ^ y 3 - * 4 ^ x 2 + * 3 y x
post-order
23 x 2 ^ * 14 y 3 ^ * + 4 x 2 ^ * 3 y * x + - /
tree(optional):
/
|
|__
||
+-
|__|
|| ||
***+
__|____|____|____|__
||| || | | |
23^14^ 4^ *x
__|____|____|____|__
| || || || |
x2y3 x 2 3y
PLS HELP ME TO DO THIS!!!
1 + 3 is in-order. I believe pre-order is + 1 3 and post-order is 1 3 +; otherwise it's the other way around.
Pre-Order>Root ->Left Subtree->Right Subtree.Post-Order-->Left Subtree->Right Subtree->Root.In-Order>Left Subtree->Root->Right Subtree.
here's the example input...
example input..
((23x^2)+(14y^3))/((4x^2)-(3y+x))
the program will show this:
pre-order
- + * 23 ^ x 2 * 14 ^ y 3 - * 4 ^ x 2 + * 3 y x
post-order
23 x 2 ^ * 14 y 3 ^ * + 4 x 2 ^ * 3 y * x + - /
i put my example there but the tree was misaligned.
I forgot how to do it exactly, but you're gonna implement a stack..Like if the first character is a (, then push it into the stack.. Something like that..
here's my example input...example input..(23x^2+14y^3)/(4x^2-(3y+x))the program must show this:pre-order- + * 23 ^ x 2 * 14 ^ y 3 - * 4 ^ x 2 + * 3 y xpost-order23 x 2 ^ * 14 y 3 ^ * + 4 x 2 ^ * 3 y * x + - /
DoYourOwnHomeworkYou're not asking for "help". You're asking for someone to just do it for you. Not likely gonna happen. Better get cracking!
> Do
> Your
> Own
> Homework
>
> You're not asking for "help". You're asking for
> someone to just do it for you. Not likely gonna
> happen. Better get cracking!
Abiss would do it (to "Get the Dukes"), but I doubt he would be successful at it. (I think he misspelled his moniker. It should be abyss.) ;-)
mr/ms warnerja, i just want to know the logic not the real answer. our prof gave this thing without even explaining it to us / without giving us just tips in this. were just newbie in java. i dont know what our prof thinking about us.
I know, it's always the prof's fault. They're supposed to be able to make you become a pro at the subject matter, regardless of whether or not you have an aptitude for it or the appropriate amount of intelligence as a prerequisite.P.S. Was this not obviously a flame?
> mr/ms warnerja, i just want to know the logic not the
> real answer. our prof gave this thing without even
> explaining it to us / without giving us just tips in
> this. were just newbie in java. i dont know what our
> prof thinking about us.
Maybe your prof did it so that you could learn how to figure out things on your own. IMO that is the most valuable skill a programmer can have, so I would suggest you develop it.
zadoka at 2007-7-21 17:19:47 >

i dont know if he already did it. our subj is just algorithm but he wants us to make a java program about that topic
aghiea at 2007-7-21 17:19:47 >

i have done this exact same thing once a long time ago. i probably still have teh codez