Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    I think you missed to read the forum rules
    Quote 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.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by petermichael View Post
    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

  • #5
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if you have this expression a+(b*c) how can construct a binary tree for this expression.

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by petermichael View Post
    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

  • #7
    uou
    uou is offline
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    •