Hey there! Sign in to join this conversationNew here? Join for free

D1 binary search help Watch

Announcements
    • Thread Starter
    Offline

    16
    ReputationRep:
    Name:  y.png
Views: 44
Size:  33.2 KB Hi, I am uncertain about how part b is worked out. From part a, I know that 3 comparisons are needed to find Hussein. So does it mean that the maximum no of comparison in any list would be the actual number of comparisons +1? If not, how is 4 deduced for b?

    Thanks
    • Community Assistant
    Offline

    18
    ReputationRep:
    (Original post by coconut64)
    Name:  y.png
Views: 44
Size:  33.2 KB Hi, I am uncertain about how part b is worked out. From part a, I know that 3 comparisons are needed to find Hussein. So does it mean that the maximum no of comparison in any list would be the actual number of comparisons +1? If not, how is 4 deduced for b?

    Thanks
    The maximum number of comparisons in a binary search where there are n items is log_2(n)

    Because the list essentially divides by 2 each time.
    • Thread Starter
    Offline

    16
    ReputationRep:
    (Original post by NotNotBatman)
    The maximum number of comparisons in a binary search where there are n items is log_2(n)

    Because the list essentially divides by 2 each time.
    Does this work for all binary search questions? Cheers
    • Community Assistant
    Offline

    18
    ReputationRep:
    (Original post by coconut64)
    Does this work for all binary search questions? Cheers
    For maximum number of comparisons only, yes.
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Will you be richer or poorer than your parents?
    Useful resources

    Make your revision easier

    Maths

    Maths Forum posting guidelines

    Not sure where to post? Read the updated guidelines here

    Equations

    How to use LaTex

    Writing equations the easy way

    Student revising

    Study habits of A* students

    Top tips from students who have already aced their exams

    Study Planner

    Create your own Study Planner

    Never miss a deadline again

    Polling station sign

    Thinking about a maths degree?

    Chat with other maths applicants

    Can you help? Study help unanswered threads

    Groups associated with this forum:

    View associated groups
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.