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
SMART PEOPLE NEEDED
mario62 [17]
D doesn't make much sense, it's valid, but not what we're looking for. B also has a correlation with D, same reasoning applies. As for A, it seems pretty legit, but I don't believe that's what we're looking for.

Choice C is the most obvious one though. We're talking about a network and as may or may not know it's a wireless one in a manner of speaking. A <span>couple of computers in the network that have trouble maintaining a signal will indefinitely lead to failure of a network since both the links and nodes of certain computer systems are incapable of maintaining a signal. </span>
6 0
3 years ago
Write a python program to calculate the length of any string recursively​
Solnce55 [7]

Answer:

b

Explanation:

6 0
2 years ago
Does an android tablet have a hard drive
Kisachek [45]
No, it uses flash menory
3 0
3 years ago
Professional networking is important for strengthening your professional development. Discuss how reading, writing, and speaking
Sergeeva-Olga [200]
Developing your reading skill helps you majorly, being able to read well is a skill not all have, and being able to read faster and better helps you'll need this sought after skill to be able to read the articles and present them to anyone you need to, as well and professionally as possible.

Developing your writing skills helps by, you'll be able to present your work and write better to really get your audience attention and make a point to them.

Developing your speaking skills helps for you to speak loudly and clearly. Doing this makes you seem confident and professional vital for business.
7 0
3 years ago
Which statement about synchronous communication is true?
tangare [24]
In general, synchronous communication means you have to wait for the answer all the time. The programming logic is simpler, but the cost that you spend a lot of time waiting.

If the options are:

<span>a. The people communicating don't need to be online at the same time.
b. There is lag time in the communication.
c. The communication occurs in real time.

a is false, you do need to be online to receive the message
b is true, typically you continue only after an acknowledgement
c is true, you wait for acknowledgement that occurs in real time (not necessarily fast though)</span>
3 0
3 years ago
Other questions:
  • "The pkill command terminates _________."
    14·1 answer
  • “Green Technology” is also known as what?
    11·1 answer
  • Which of the following is a non timber forest product
    7·1 answer
  • The __________ method can determine whether a string contains a value that can be converted to a specific data type before it is
    12·1 answer
  • Whats the correct answer
    15·2 answers
  • To print a budget:________.
    9·1 answer
  • The Self-Quiz gives you an opportunity to self-assess your knowledge of what you have learned so far.
    13·1 answer
  • This seems like a good time to ask the basic question, “How’s it going in class?” Feel free to offer constructive feedback about
    6·2 answers
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
  • An operating system is defined as hardware that converts software into a useful form for applications.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!