Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Binary Tree Help (c Lang)

1. ## Binary Tree Help (c Lang)

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.

• I think you missed to read the forum rules
Originally Posted by 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.

• 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?

• Originally Posted by petermichael
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

• if you have this expression a+(b*c) how can construct a binary tree for this expression.

• Originally Posted by petermichael
if you have this expression a+(b*c) how can construct a binary tree for this expression.
Code:
```  +
/  \
a   ()
|
*
/  \
b   c```
http://en.wikipedia.org/wiki/Polish_notation

regards

• 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????????

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•