Thread: problem in binary expression tree

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    4

    Question problem in binary expression tree

    I have a problem in buildding a binary expression tree. the expression could look such as "a+(b*c)/d" . so please if you can give some hints i'll be thankfull.

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    What is the problem?

  3. #3
    Registered User stautze's Avatar
    Join Date
    Apr 2002
    Posts
    195
    Do you have to write the code for the tree?

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    4

    Post

    well the problem is ( I can't write the code to build this expression tree ), by the way i wrote the code to calculate this expression tree, but till now i couldn't write the code to build this tree. you know that in an expression tree the root node should be an operator in the middle of the expression, ex. [a+(b*c) the root node must be +, then the node to the left of it i put (a) and the node to the right of the root i put (*) to the left (b) and finally (c) to the right.] a friend of mine told me that i should use two Stacks one for opertaors and the other for the operands, but it didn't work right

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    This question was answered not too long ago.
    http://www.cprogramming.com/cboard/s...xpression+tree

    -Prelude
    My best code is written with the delete key.

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    4

    Thumbs up

    thanx Prelude
    am a new member, so i don't know what has been posted in the past. anyway this answers all my questions. thanx man

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    4

    Exclamation

    hey....any one have another way to build a binary expression tree please post it here .... 'cause i'll learn how others could think and solve problems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please help! Dynamic binary tree problem
    By robsmith in forum C Programming
    Replies: 2
    Last Post: 03-15-2005, 09:56 PM
  2. problem in storing data in a binary search tree
    By alavardi in forum C Programming
    Replies: 5
    Last Post: 02-13-2005, 03:20 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Problem with binary search tree :(
    By Unregistered in forum C Programming
    Replies: 10
    Last Post: 05-01-2002, 10:31 PM
  5. binary tree node structure
    By Kirsten in forum C Programming
    Replies: 2
    Last Post: 04-26-2002, 08:02 PM