answer.
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
artcher [175]
2 years ago
8

Write three functions in C/C++: one that declares a large array statically, one that declares the same large array on the stack,

and one that creates the same large array from the heap. Call each of the subprograms a large number of times (at least 100,000) and output the time required by each. Explain the results. Explain why or why not you cant do this in Java, what are the implication of this? If you can’t specify which type of array can you not declare.
Computers and Technology
1 answer:
Nikolay [14]2 years ago
7 0

Answer:

See explaination

Explanation:

#include<iostream>

#include<stack>

#include <algorithm> // std::make_heap, std::pop_heap, std::push_heap, std::sort_heap

#include <vector> // std::vector

using namespace std;

void StaticArray()

{

unsigned int array[64536];

for(unsigned int i=0;i<64536;i++)

array[i]=i;

}

void Stack()

{

stack<unsigned int> mystack;

for(unsigned int i=0;i<64536;i++)

mystack.push(i);

}

void Heap()

{

unsigned int myints[64536];

for(unsigned int i=0;i<64536;i++)

myints[i]=i;

vector<unsigned int> v(myints,myints+64535);

make_heap (v.begin(),v.end());

push_heap (v.begin(),v.end());

}

int main()

{

StaticArray();

Stack();

Heap();

return 0;

}

You might be interested in
Assume that machines A and B are on the same network 10.3.2.0/24. Machine A sends out spoofed packets, and Machine B tries to sn
Zanzabum

Answer:

Explanation:

Assuming the spoofed 1.2.3.4, it will be sent out ARP to a router that is alive and get it MAC. Then the spoofed packet will be able to be sent out. If A spoofed 10.0.2.30, because it is a local address, it will send an ARP to the machine for been able to get the MAC. But, the IP address 10.0.2.30 is not original making it to be fake, so it will not replay to A, for this reason the spoofed packet cannot be sent out.

7 0
2 years ago
In the next five years there are expected to be over _____ unfilled jobs in the US in computer science.
Marta_Voda [28]

Answer:

The correct answer is D) 1 Million

Explanation:

It has been predicted that in about five years the Information Technology sector in the United States will have about 1 million unfilled roles in computer science.

Cheers!

4 0
2 years ago
Given an int variable k, an int array incompletes that has been declared and initialized, an int variable studentID that has bee
Feliz [49]

Answer:

check the explanation

Explanation:

Variables when it comes to programming are used to store data to be documented and manipulated in a computer program. They can also be used for labeling stored data with a descriptive name and any other needed details, so that the programs can be comprehended more understandably by the reader and ourselves.

to solve the question, we will write this set of codes;

numberOfIncompletes = 0;

for(k = 0; k < incompletes.length; k++)

{

       if(incompletes[k] == studentID)

           numberOfIncompletes++;

}

7 0
2 years ago
1. Do you consider Facebook, MySpace, and LinkedIn forms of disruptive or sustaining technology? Why?
Mrrafil [7]
It mainly just depends on if you "misuse" them.
8 0
2 years ago
The __________ vulnerability assessment is a process designed to find and document selected vulnerabilities that are likely to b
forsale [732]
The risk vulnerability assessment is the answer
5 0
2 years ago
Other questions:
  • What will be the output of “AAAAMMMMMHHHVV” using a file compression technique?
    9·2 answers
  • Write the definition of a function named quadratic that receives three double parameters a, b, c. If the value of a is 0 then th
    12·1 answer
  • Write a Python function called simulate_observations. It should take no arguments, and it should return an array of 7 numbers. E
    7·1 answer
  • The computer component that makes sure that instructions are decoded and executed properly is the ___________.
    11·2 answers
  • The following checksum formula is widely used by banks and credit card companies to validate legal account numbers: d0 + f(d1) +
    13·1 answer
  • A Color class has a method getColorName that returns a string corresponding to the common name for the color, e.g., yellow, blue
    11·1 answer
  • 15) The codes for class Hotel has been defined in two separate files Hotel.h, and Hotel.cpp. Which of the following statements i
    12·1 answer
  • Which of the following statements is true regarding input and output?
    12·2 answers
  • Checkpoint 10.43 Write an interface named Nameable that specifies the following methods: _______{ public void setName(String n)
    12·1 answer
  • Accenture has partnered with a global construction company that specializes in building skyscrapers. The company wants better ma
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!