Binaray search tree (reverse, postorder)

This is a discussion on Binaray search tree (reverse, postorder) within the General Discussions forums, part of the Community Boards category; We have the following sequence of numbers : 10, 2, 7, 6, 3, 8, 5, 18, 1 and 9 a.) ...

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    8

    Binaray search tree (reverse, postorder)

    We have the following sequence of numbers : 10, 2, 7, 6, 3, 8, 5, 18, 1 and 9

    a.) Draw binary search tree, which originate, if numbers from sequence are inputed into empty binary search tree and write out sequence of numbers in reverse traversal of a tree
    b.)Draw binary search tree, which originate, if numbers from sequence are inputed into empty binary search tree in reverse order and write out sequence of numbers in preorder traversal.

    Thanks for you help guys

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,647
    Are you required to implement a C program here, or is this just a matter of computer science?

    Oh, and what have you tried?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    8
    I do not need any code i just need to draw binary search tree with this numbers but i do not know how to start

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,647
    *Thread moved to General Discussions*

    Quote Originally Posted by amazineous
    i just need to draw binary search tree with this numbers but i do not know how to start
    Review your notes on binary search trees. In particular, try to construct the examples to get an understanding of what they are about.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Mar 2012
    Posts
    8
    Are there many possible solutions to this problem ? And how do i know which number is the root. Is it right if i order this numbers into ascending order first and than i construct a binary tree?

  6. #6
    Registered User
    Join Date
    Aug 2003
    Posts
    1,203
    The way I read the question you should construct the binary search tree that would result from inserting the numbers in sequence into an empty tree. That is, start with an empty tree, then construct the tree you get by inserting the number 10. Then take that tree and construct the tree you get from inserting the number 2 and so on. More info on binary search tree: Binary search tree - Wikipedia, the free encyclopedia

  7. #7
    Registered User
    Join Date
    Mar 2012
    Posts
    8
    So would anyone of you guys who knows how to construct this binary tree be so kind and show me because i got no clue how to start

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Did you read Shakti's post?

    If you use 10 as the root, do you know where 2 will go?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PostOrder Transversal binary search tree?
    By kevin99 in forum C Programming
    Replies: 4
    Last Post: 06-22-2012, 08:19 AM
  2. Binary Search Tree-search method help?
    By shocklightning in forum C++ Programming
    Replies: 5
    Last Post: 03-25-2012, 10:57 PM
  3. Tree Search
    By Fatima Rizwan in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2010, 09:35 AM
  4. Search Engine - Binary Search Tree
    By Gecko2099 in forum C Programming
    Replies: 9
    Last Post: 04-17-2005, 02:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21