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
zaharov [31]
3 years ago
12

Using the programs given in the appendix of this lab, write two programs: • One that will use a Linear search to find the amount

of time it takes to find (or not find) the number: 99,999,999. • One that will use a Binary search to find the amount of time it takes to find (or not find) the number: 99,999,999. • The only difference between the two programs will be the search function. • Record the amount of time it takes to do the Binary Search as well as the Linear search. • Run the test at least 5 times each.
Computers and Technology
1 answer:
miss Akunina [59]3 years ago
6 0

Answer:

// C++ code to linearly search x in arr[]. If x  

// is present then return its location, otherwise  

// return -1  

#include <iostream>  

using namespace std;  

int search(int arr[], int n, int x)  

{  

int i;  

for (i = 0; i < n; i++)  

 if (arr[i] == x)  

  return i;  

return -1;  

}  

int main(void)  

{  

int arr[] = { 2, 3, 4, 10, 40 };  

int x = 10;  

int n = sizeof(arr) / sizeof(arr[0]);  

int result = search(arr, n, x);  

(result == -1)? cout<<"Element is not present in array"

   : cout<<"Element is present at index " <<result;  

return 0;  

}  

You might be interested in
Write a MATLAB script that prompts the user to input the following array by providing an example in the prompt: [2 4;6 3;5 9]. C
Margaret [11]
Do kknthbtg euk dyr u vex m(ya we p ugh
Ute I’ll R we
Mmm
3 0
3 years ago
Which version represents the video project after the assembly cut has been completed, transitions and special effects have been
yuradex [85]

Answer:

D.final cut

Explanation:

it well help for the non-liris editing in film or others

7 0
3 years ago
You attempt to telnet to system 192.168.1.240. You receive the following message: "Connecting To 192.168.1.240...Could not open
Serjik [45]

Answer:

firewall

Explanation:

The firewall could be used to protect the network from unauthorised access.Usually an ip could be whitelisted so it could transfer packets between allowing it connect through.

3 0
3 years ago
What are the advantages of hybrid computer
Lemur [1.5K]

The advantages of hybrid computers are:

  • They have a large amount of computing speed speed that is often helped by the all-parallel configuration made by the analog subsystem.
  • It is very useful in terms of numerical solutions for any work of differential equations and also in flight simulation.

<h3>What is an advantage of hybrid computing?</h3>

Hybrid cloud computing is known to be one that gives businesses a lot of control over their data and it is one that have a good or better security as it tends to lower the risk of exposure of data.

Note that,The advantages of hybrid computers are:

  • They have a large amount of computing speed speed that is often helped by the all-parallel configuration made by the analog subsystem.
  • It is very useful in terms of numerical solutions for any work of differential equations and also in flight simulation.

Learn more about hybrid computing from

brainly.com/question/21474132

#SPJ1

3 0
2 years ago
While working on a group project, you notice something does not look right in the presentation. You call a meeting with your tea
alexgriva [62]

Answer:

Teamwork

Explanation:

4 0
4 years ago
Other questions:
  • 24 bit or 16 million colors is often called?
    7·1 answer
  • The number of pixels displayed on the screen is known as ________.
    14·1 answer
  • What does NVRAM stand for
    8·2 answers
  • Which option should she use to add the terms
    6·1 answer
  • To find if the Library owns the item listed below using Quick SearchLinks to an external site., what would you type in the searc
    9·1 answer
  • Which is the best book for digital electronics?
    5·1 answer
  • How should I represent myself online? ​
    7·1 answer
  • The correct banner marking for unclassified documents with cui is
    9·1 answer
  • Please help me on this it’s due now
    5·1 answer
  • The. Model has the disadvantage of high project cost due to creation several prototypes
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!