Welcome to Westonci.ca, your ultimate destination for finding answers to a wide range of questions from experts. Get detailed and accurate answers to your questions from a community of experts on our comprehensive Q&A platform. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

what is the third step using binary search to look for the number 32 in this list: 1, 2, 3, 4, 10, 11, 16, 25, 32, 33, 45, 47, 51, 69, 75 submit compare the number 25 to the given number. compare the number 4 to the given number compare the number 33 to the given number compare the number 47 to the given number.

Sagot :

Step number 3 is to compare the number 33 with the given number. Below is code in C++ where you can check it.

C++ code

#include<iostream>

using namespace std;

int main()

{

  •    //Initialize list and variables

   int step,n,half,first,last,ext;

   int list[] = {1,2,3,4,10,11,16,25,32,33,45,47,51,69,75};

   first = 0;

   last = 14;

   ext = 0;

   step = 0;

   cout<< "Entry number to find: ";

   cin>> n;

  •    //Binary Search

   while (first <= last and ext == 0)

   {

  •       //submit comparison

       half = (first+last)/2;

       step=step+1;

       cout << "Step: " << step;

       cout << " Compare the number " << list[half] << " with "  << n <<endl;

       if (n == list[half])

           ext = 1;

       if (n < list[half])

           last=half-1;

       if (n > list[half])

           first=half+1;

   }

}

To learn more about Binary search see: https://brainly.com/question/21475482

#SPJ4

View image megatokay