Welcome to Westonci.ca, the ultimate question and answer platform. Get expert answers to your questions quickly and accurately. Join our Q&A platform and connect with professionals ready to provide precise answers to your questions in various areas. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.

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
Thank you for trusting us with your questions. We're here to help you find accurate answers quickly and efficiently. We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. Thank you for visiting Westonci.ca, your go-to source for reliable answers. Come back soon for more expert insights.