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
artcher [175]
3 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]3 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
How to transfer photos from iphone to iphone?
STALIN [3.7K]
If you have icloud then you can transfer them.
7 0
3 years ago
Read 2 more answers
When was kale discovered?
anyanavicka [17]
Kale was discoverd just 2 years ago ........
8 0
4 years ago
Is there a way I can put an already made sound that i created over an already made video
lys-0071 [83]
If you're using an apple product to do video editing, then iMovie is probably the best way to do that.

If you're on Windows and you're looking for a free video editing website, I'd suggest WeVideo. Although WeVideo does add watermarks to your videos, editing is pretty easy when using it.
6 0
4 years ago
According to the video, what types of education are useful for Database Administrators? Check all that apply.
LUCKY_DIMON [66]

Answer:

college degrees and certification.

Explanation

7 0
3 years ago
Read 2 more answers
A personal computer can only have one operating system installed on it. true false
Pani-rosa [81]
It is true, because if you would try installing another OS after installing the first one, you would overwrite the OS which you installed before.
but in the second opinion an workstation is technically able to dual boot by installing differend operating systems on different drives. which approves that both answers can be right.
8 0
3 years ago
Other questions:
  • How can you ensure that your web pages are compliant with a w3c standard?
    9·1 answer
  • A chiropractor is looking at the Security Standards Matrix and believes that it is unnecessary to address the encryption and dec
    8·1 answer
  • Why is redundancy of data undersirable?
    7·2 answers
  • I thought the answer was senior manager see on google it says
    8·1 answer
  • You are part of an Information Systems project team. Your job is to ensure that the technology and vendor suggested for use in t
    12·1 answer
  • Consider the following code segment. The code is intended to read nonnegative numbers and compute their product until a negative
    11·1 answer
  • When did computer networking go beyond the walls of the firm?
    15·1 answer
  • What techniques can be used to assess a product?
    12·2 answers
  • Most presentations use text: A. To draw attention to content
    8·1 answer
  • Technician A says that a camshaft must open and close each valve at exactly the right time relative to piston position. Technici
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!