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
kifflom [539]
2 years ago
9

Write a program to implement problem statement below; provide the menu for input N and number of experiment M to calculate avera

ge time on M runs. randomly generated list. State your estimate on the BigO number of your algorithm/program logic. (we discussed in the class) Measure the performance of your program by given different N with randomly generated list with multiple experiment of Ns against time to draw the BigO graph (using excel) we discussed during the lecture.
Computers and Technology
1 answer:
zalisa [80]2 years ago
8 0

Answer:

Explanation:

#include<iostream>

#include<ctime>

#include<bits/stdc++.h>

using namespace std;

double calculate(double arr[], int l)

{

double avg=0.0;

int x;

for(x=0;x<l;x++)

{

avg+=arr[x];

}

avg/=l;

return avg;

}

int biggest(int arr[], int n)

{

int x,idx,big=-1;

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

{

if(arr[x]>big)

{

big=arr[x];

idx=x;

}

}

return idx;

}

int main()

{

vector<pair<int,double> >result;

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

int choice;

cin>>choice;

while(choice!=2)

{

int n,m;

cout<<"Enter N"<<endl;

cin>>n;

cout<<"Enter M"<<endl;

cin>>m;

int c=m;

double running_time[c];

while(c>0)

{

int arr[n];

int x;

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

{

arr[x] = rand();

}

clock_t start = clock();

int pos = biggest(arr,n);

clock_t t_end = clock();

c--;

running_time[c] = 1000.0*(t_end-start)/CLOCKS_PER_SEC;

}

double avg_running_time = calculate(running_time,m);

result.push_back(make_pair(n,avg_running_time));

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

cin>>choice;

}

for(int x=0;x<result.size();x++)

{

cout<<result[x].first<<" "<<result[x].second<<endl;

}

}

You might be interested in
Iglesias intends to use a word processing program to create a web page. Which of these options should Iglesias use?
Murrr4er [49]
He should view the Outline THEN the Layout and finally preview in web browser.
6 0
3 years ago
Kevin wants an application that will help him create a website as well as publish it. What application can he use?
AURORKA [14]

Answer:

D

Explanation:

Adobe Dreamweaver can hep him make a website and publish it.

3 0
3 years ago
Do you ever just . . . . . . . . . . . . .
Nezavi [6.7K]

Answer:

sure? *confusion*

Explanation:

4 0
3 years ago
Read 2 more answers
When you send an email how many computers does it go to
Xelga [282]

once you have sent the email it will only go to the server which then the person receiving it would log on therefore requesting the emails recived.

I'm not 100% sure my answer is classed as correct but I would say it doesn't go to a computer it just gets stored on a server in till requested

4 0
3 years ago
Your company requires computers to authenticate to one another and enforces this requirement with Windows Defender Firewall with
lubasha [3.4K]

There are a lot of rules in computing. The above can be done with authentication exemption.

<h3>What is Authentication exemptions?</h3>

This is a method that helps one to be able to specify a particular group of computers.

Conclusively, This can be done via their Active Directory computer account name or the use of their IP address. Tis does not apply to existing connection security rules.

Learn more about   authentication exemption from

brainly.com/question/25739714

7 0
2 years ago
Other questions:
  • Can your computer become infected with a virus via email
    10·1 answer
  • Which cisco ios command is used to display the current ospf neighbors and their rids?
    11·1 answer
  • A. True <br> b. False: variables represent storage locations in the computer's memory.
    13·1 answer
  • 1. Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bit memory address
    7·1 answer
  • Computers and Technology:
    14·1 answer
  • Aaron is stating the main idea of what he read in his own words. He is _____.
    11·2 answers
  • Select the correct answer from each drop-down menu. A company is recruiting for a web designer. What kind of candidate should th
    14·2 answers
  • What is the different sheets in excel
    15·1 answer
  • If your computer determines the destination address of a network packet is to a remote network.
    9·1 answer
  • External hard drives typically connect to a computer via an external port (such as a usb or ____ port) or a wireless connection.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!