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
Ann has always wanted to be the person on the news broadcast who delivers the weather updates. She’s looking into becoming a bro
Marrrta [24]
The answer should be A.
5 0
3 years ago
Read 2 more answers
Which of the following is a trademark automatically received by an organization when a symbol is being consistently used in the
Mashcka [7]

Complete Question:

Which of the following is a trademark automatically received by an organization when a symbol is being consistently used in the normal course of business?

Group of answer choices

A. Open source trademark.

B. Common law trademark.

C. Registered trademark.

D. Open source trademark.

Answer:

B. Common law trademark.

Explanation:

A common law trademark can be defined as a protection or enforceable mark for a product name, logo, symbol or brand name used to distinguish goods and services prior to its registration with the state or federal government. Common law trademark is a trademark which is automatically received by an organization when a symbol is being consistently used in the normal course of business.

This ultimately implies that, common law trademarks are not governed by any statute and as such are only limited to the geographical location where they are used.

For instance, if a tomato paste is being sold to consumers with the product name "Ginoo" in Florida, the company's trademark applies to Florida only. Thus, another company can use the product name without any trademark infringement in other states of the country such as New York, Washington DC, California etc. except in Florida due to a common law trademark.

4 0
3 years ago
PLS HELP) Early word processors ran on devices that looked like digital _______?
stealth61 [152]
I looked it up it just says true
8 0
3 years ago
Read 2 more answers
What property do we use to distinguish a specific element from a form? value name click this
Andrews [41]
<span>If you match the physical properties of a substance you dont know about to the properties of a known substance, you now know what you've got. For example, if you know that compound X is bright yellow and screams when you poke it, an unknown sample that is yellow and screams that you poke it is probably compound X. trust me, im a dog in a suit.</span>
7 0
3 years ago
WHAT DO YOU KNOW?<br> Why would you want to change your Table<br> Properties?
joja [24]

read the slides ;  Table Properties are the way the table appears or looks.

6 0
2 years ago
Other questions:
  • What feature could you use to automatically shade cells containing a negative value in red?
    7·2 answers
  • The rod and crankshaft convert the up-and-down motion of the piston into
    12·2 answers
  • Would these statements cause an error? Why or why not? int year = 2019; int yearNext = 2020; int &amp; ref = year; &amp; ref = y
    7·1 answer
  • Which is a copyright
    13·2 answers
  • 1) Why is angle of view important? What are some of the ways that you can do this?
    6·1 answer
  • What is most important for you to choose before you build a network?
    6·1 answer
  • What are two options available for highlighting changes in the Highlight Changes dialog box?
    11·2 answers
  • Which data type can store decimal or fractional numbers?
    15·2 answers
  • Write a function named swapFrontBack that takes as input a vector of integers. The function should swap the first element in the
    9·1 answer
  • an engineer is writing a web application that requires some user input. the engineer has put a submit button on their page and n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!