1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
8_murik_8 [283]
2 years ago
6

How many passes will it take to find 30 using a binary search?

Computers and Technology
1 answer:
dimulka [17.4K]2 years ago
7 0
Just wanna let you know I could be wrong but I think 4 passes
You might be interested in
Integers and booleans. Write a program RightTriangle that takes three int command-line arguments and determines whether they con
icang [17]

Answer:

<em>The programming language is not stated;</em>

<em>I'll answer using C++</em>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

int side1, side2, side3;

cout<<"Enter the three sides of the triangle: "<<endl;

cin>>side1>>side2>>side3;

if(side1<=0 || side2 <= 0 || side3 <= 0) {

 cout<<"Invalid Inputs";

}

else {

 if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else {

  cout<<"Not Right Angled";

 }

}

return 0;

}

Explanation:

The following line declares the three variables

int side1, side2, side3;

The next line prompts user for input of the three sides

cout<<"Enter the three sides of the triangle: "<<endl;

The next line gets user input

cin>>side1>>side2>>side3;

The following if condition checks if any of user input is negative or 0

<em> if(side1<=0 || side2 <= 0 || side3 <= 0) { </em>

<em>  cout<<"Invalid Inputs"; </em>

<em> } </em>

If otherwise

else {

The following if condition assumes that side1 is the largest and test using Pythagoras Theorem

<em>if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side2 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side3 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

If none of the above conditions is true, then the triangle is not a right angles triangle

<em>  else { </em>

<em>   cout<<"Not Right Angled"; </em>

<em>  } </em>

}

return 0;

Download cpp
4 0
3 years ago
Need help this is for my technology class. We are doing a city research paper but it’s the rough draft and I’m doing la. But I c
serious [3.7K]
One business is " Backwards Beekeepers," Your welcome. >,<
5 0
3 years ago
Read 2 more answers
What are three recommendations for reducing risk and improving the privacy of your personal information while using social media
viktelen [127]

Answer:

1. Treat the “about me” fields as optional.

2. Become a master of privacy settings.

3. Know the people you friend.

Explanation:

1. Treat the “about me” fields as optional.

Because these fields are offered, however, doesn’t mean you must fill them out. Consider offering a general version of the information requested or simply leaving the field blank. For instance, listing only your state of residence, instead of both city and state, can make it harder for others to figure out exactly where you live.

2. Become a master of privacy settings.

All social media sites give you the option to limit post viewing to specific audiences. Take the time to explore these settings, try different options, and become a master of their use.

3. Know the people you friend.

Once upon a time, social media users competed with one another to have the largest number of connections. Today, however, smart social media users know that the more people you’re connected to, the harder it is to control what happens to the information you post. Make sure you know the people you add on social media, in real life if possible. Don’t hesitate to use the “block” feature when the situation seems to call for it.

6 0
3 years ago
What does an interpreter or compiler turn code statements into? (Javascript)
otez555 [7]
B is the answer output DLL files 
6 0
2 years ago
I didn't go to school today and i want to know if my teacher would contact my parents.
AURORKA [14]

the school will call your parents

6 0
3 years ago
Other questions:
  • Read the PIC Data sheet Chapter 2.0 and 3.0 2. List at least 3 big differences between the Flash and RAM 3. How many RAM locatio
    5·1 answer
  • the easiest and cheapest time to alter the information system is in the ________ phase of the sdlc. a. requirements analysis b.
    8·1 answer
  • #Electrical Engineering
    13·1 answer
  • What is the definition of digital literacy?
    7·2 answers
  • What is the difference between digital art and digital design?
    8·1 answer
  • Your digital footprint says a lot about you, but not everything is true or accurate. When you're a high school or college studen
    13·1 answer
  • Code works, need help writing header file.
    8·1 answer
  • How many people are in Siver, on the game Valorant?
    14·1 answer
  • Stock Market
    11·1 answer
  • What is the difference between MySQL and MariaDB?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!