Re : binary search

This is a discussion on Re : binary search within the C Programming forums, part of the General Programming Boards category; Dear All, Can anyone tell me at most how many comparisions needed to find an item in a list of ...

  1. #1
    Unregistered
    Guest

    Unhappy Re : binary search

    Dear All,

    Can anyone tell me at most how many comparisions needed to find an item in a list of size 200 using binary and sequential search.

    For sequential search, it should be (n-1), right? i.e. if a list exist 200 items, it should be (200-1) = 199, but how about binary search, how to formulate this??? Please help.

    Thanks and best regards
    Kim

  2. #2
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    The world is waiting. I must leave you now.

  3. #3
    Unregistered
    Guest
    Hi Kim,
    Since 2^8 = 256, 8 comparisons would be adequate for a list of up to 256 items.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. searching and insertion in a binary search tree
    By galmca in forum C Programming
    Replies: 1
    Last Post: 03-26-2005, 04:15 PM
  2. deleting all nodes of a binary search tree...
    By sachitha in forum C++ Programming
    Replies: 3
    Last Post: 09-29-2004, 06:19 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 08:40 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

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