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 BASIC program to find the product of any two numbers​
GuDViN [60]

Answer:

Print 4 + 4

Explanation:

If you're writing this in the programming language called BASIC, this is how you would add any two numbers.

6 0
3 years ago
You have been given the following String which represents a series of 6 side die rolls:rolls = "1,5,2,3,5,4,4,3,1,1,1,2,3,1,5,6,
Anni [7]

Answer:

see explaination

Explanation:

rolls="1,5,2,3,5,4,4,3,1,1,1,2,3,1,5,6,2"

list1 = list(rolls.split(","))

print("The total # of rolls: {}".format(len(list1)))

j=0

for i in list1:

j+=int(i)

print("Total value of all rolls: {}".format(j))

print("Average roll: {}".format(j/len(list1)))

Please kindly check attachment for program code and output

8 0
3 years ago
You administer a Microsoft SQL Server environment. You purchase a new server and plan to migrate your database from SQL Server 2
Snezhnost [94]

Answer:

B. Migration Assistant

Explanation:

Migration assistant also referred to as the Data Migration Assistant (DMA) is a Microsoft tool used during SQL server upgrades to detect any compatibility issues that could impact the functionality of the new version of SQL server being installed. The Data Migration Assistant will also recommend performance and reliability improvements as well as allow you to move your SQL server data and schema from the source server to the destination server.

8 0
4 years ago
Match each command group under Picture Tools to the appropriate tasks.
FrozenT [24]

Answer:

look at the attachment for correct answers.

6 0
3 years ago
The line of code after a line beginning with the word 'else' needs to begin with a(n) ___.
Julli [10]
The answer to your question is D
7 0
2 years ago
Other questions:
  • 12. Good digital citizenship includes keeping in mind who has access to the internet and who does not. (1 point)
    15·2 answers
  • Which one of the following is a functional requirement? Select one: a. None of the mentioned b. Robustness c. Maintainability d.
    10·1 answer
  • What does an approved project summary document indicate?
    13·1 answer
  • If you don't know whether to write too, two, or to, you should use the spell-checker to help you decide. true or false?
    7·1 answer
  • What is one effective way for employees to keep their skill-sets current
    14·1 answer
  • Why was the Internet first developed? Use details and information to explain your answer.
    6·1 answer
  • Consider the LIBRARY relational database schema description provided below which is used to keep track of books, borrowers, and
    9·1 answer
  • What is meant by reflection?​
    9·2 answers
  • Carlos had 194 seeds and 11 flower pots he put the same number of seeds in each flower pot which is the best estimate for the nu
    6·1 answer
  • ______ is used to extract knowledge from sources of data-NoSQL databases, Hadoop data stores, and data warehouses-to provide dec
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!