Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Binary Search Trees theory question?

  1. #1
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Binary Search Trees theory question?

    Suppose that a certain BST has keys that are integers between 1 and 10, and we search for 5. Which sequence below cannot be the sequence of keys examined?

    (a) 10,9,8,7,6,5
    (b) 4,10, 8, 6, 5
    (c)1,10,2,9,3,8,4,7,6,5
    (d) 2,7,3,8,4,5
    (e)1,2,10,4,8,5

    I've noticed many differences, such as there is only one with an odd number of keys, and one has all integers from 1-10 inside of it, but I can't find any real reason that you wouldn't be able to search it?
    Does anyone know any tips for this?


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,765
    My Mood
    Mellow
    Thanks
    234
    Thanked 712 Times in 698 Posts

    Default Re: Binary Search Trees theory question?

    There are specific rules that determine the construct of a binary search tree. Look up those rules and then review the question's possible answers to see if they comply with the rules.

  3. #3
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Binary Search Trees theory question?

    These answers are not in any particular order, so couldn't they ALL be binary search trees, once correctly put into a BST?

Similar Threads

  1. Help with Dynamic linked list (Binary Trees)
    By Pip_Squeak in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 30th, 2014, 04:12 PM
  2. Binary Search Tress QUESTION
    By oscarmiles99 in forum Java Theory & Questions
    Replies: 4
    Last Post: November 13th, 2013, 05:17 PM
  3. binary trees
    By game06 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 1st, 2013, 07:58 AM
  4. Graph Search Theory with extend of BFS, UFS and A* Search in grid
    By keat84 in forum Java Theory & Questions
    Replies: 1
    Last Post: February 7th, 2012, 08:46 AM
  5. Polymorphic Binary Search Tree Question
    By MJS139115 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 9th, 2010, 05:08 PM

Tags for this Thread