Discrete Mathematics Binary Search

Click For Summary

Discussion Overview

The discussion revolves around the application of Binary Search to find the number 13 in an unsorted list of numbers. Participants explore the conditions under which Binary Search can be applied and the number of comparisons involved in searching for a value.

Discussion Character

  • Homework-related
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant questions the number of comparisons needed to find 13 in the list, suggesting 10 comparisons, and seeks clarification.
  • Another participant points out that Binary Search cannot be performed on an unsorted list and suggests that a linear search would require 5 comparisons.
  • A participant expresses confusion about the Binary Search process, indicating a misunderstanding of how the algorithm operates and suggesting that they thought it required going through each number twice.
  • Further clarification is provided on how Binary Search would work if the list were sorted, illustrating that it would require fewer comparisons than a linear search.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the application of Binary Search to the given list, with some asserting it cannot be used due to the list being unsorted, while others express confusion about the algorithm's mechanics.

Contextual Notes

The discussion highlights the importance of sorting in Binary Search and the potential for misunderstanding the algorithm's requirements and operation.

Joystar77
Messages
122
Reaction score
0
How many comparisons are performed to find 13 in the following list by using Binary Search?

7, 12, 5, 22, 13, 32

Is it true that there are 10 comparisons performed to find 13 in the following list by using Binary Search? If this isn't right, then can somebody please help explain this to me?
 
Technology news on Phys.org
Joystar1977 said:
How many comparisons are performed to find 13 in the following list by using Binary Search?

7, 12, 5, 22, 13, 32

Is it true that there are 10 comparisons performed to find 13 in the following list by using Binary Search? If this isn't right, then can somebody please help explain this to me?

Welcome to MHB, Joystar1977!

You can't really do a binary search on this list.
It needs to be sorted for that.
A linear search would do 5 comparisons, since 13 is the 5th number in the list.
How did you get to 10 comparisons?
 
Hello I Like Serena! In response to your questions, I was looking at an example for Binary Search where it says that "binary search relies on a divide and conquer strategy to find a value within an already sorted collection." Maybe I got confused but I thought that since it asked me to do a binary search then I would have to go through each of the numbers twice (7, 12, 5, 22, 13, 32) by pressing start, middle (value), and then the end. I thought that the algorithm was deceptively simple.
 
Joystar1977 said:
Hello I Like Serena! In response to your questions, I was looking at an example for Binary Search where it says that "binary search relies on a divide and conquer strategy to find a value within an already sorted collection." Maybe I got confused but I thought that since it asked me to do a binary search then I would have to go through each of the numbers twice (7, 12, 5, 22, 13, 32) by pressing start, middle (value), and then the end. I thought that the algorithm was deceptively simple.

As you said: divide and conquer.

If the list were sorted like (5,7,11,12,13,32), binary search might:
- start with entry 11 and see that 13 is to the right,
- then try 13, and with the 2nd comparison, it would be done.

As you can see, if the list is sorted, binary search needs way less comparisons than a linear search.
 
Thank you so much for explaining this to me I Like Serena! I really and truly do appreciate it.
Joystar1977
 

Similar threads

Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
5K