...

View Full Version : Binary Tree Help (c Lang)



petermichael
06-21-2008, 01:58 PM
I have this task and i dont know how to do it, any help will be appreciated
I want to do it in C language under linux
Evaluate Boolean expression given by the user by using tree data structure. An example of the Boolean expression is ((X1 * X2 * X3) + (X2 * X4) + (X5))

Where * and + is not static, i mean they can be any operator.

abduraooft
06-21-2008, 02:20 PM
I think you missed to read the forum rules (http://www.codingforums.com/rules.htm)

1.5) No homework assignments - Do not post your entire homework assignment and request that other members do it for you. This is considered cheating, and your thread may even be used by your school to prove your guilt. Now, you may ask for advice or help on a specific aspect of your assignment that you're having trouble with. Use common sense as far as what's acceptable in terms of soliciting help with homework assignments.

petermichael
06-21-2008, 02:24 PM
My problem is with the array, sorry i missed saying that,
the problem i face is that to construct the tree i need an array containing characters and integers, how can i make 1 array that contain both?

oesxyl
06-21-2008, 02:39 PM
My problem is with the array, sorry i missed saying that,
the problem i face is that to construct the tree i need an array containing characters and integers, how can i make 1 array that contain both?
- why do you need to mix characters and integers in same array?
- why do need a array?

you can use a union as item in array to store both type.

regards

petermichael
06-27-2008, 11:54 AM
if you have this expression a+(b*c) how can construct a binary tree for this expression.

oesxyl
06-27-2008, 12:24 PM
if you have this expression a+(b*c) how can construct a binary tree for this expression.


+
/ \
a ()
|
*
/ \
b c


http://en.wikipedia.org/wiki/Polish_notation

regards

uou
06-27-2008, 03:55 PM
i guse you can but your element of your expression in astack in ordere and whene you make a pop process inthesame time you can do an insertion of three
But idon't know how make it in the same time????????



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum