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]
1 year 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]1 year 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
An author is preparing to send their book to a publisher as an email attachment. The file on their computer is 1000 bytes. When
Yakvenalex [24]

Answer:

See explanation

Explanation:

My explanation to the author is that:

The reduction in size of the attachment doesn't mean that some parts of the book (i.e. the attachment) has been deleted.

I'll also made him understand that the book will retain its original size and contents after downloading by the recipient of the mail.

6 0
2 years ago
3) 5, 10, 15, 20 are items of data. Explain how these could become information and what knowledge
yKpoI14uk [10]

For example when there is research on how many people shoplift in a shopping centre per week. These numbers could show a increase in the number of shoplifters per week.

8 0
1 year ago
What would make this comparison statement False? Complete with the appropriate relational operator. "G" _____= "G"
My name is Ann [436]

Equality and Relational Operators

For the statement to return false, you can simply use the "not equal to" equality operation. The full symbol of this operation is '!=', disregarding the quotes.

<u>Examples:</u>

  • [1 != 1]  would produce FALSE. Translation: 1 <u>does not equal</u> 1?
  • [1 == 1]  would produce TRUE. Translation: 1 <u>does</u> 1?
  • ["G" != "G]  would produce <u>FALSE</u>. Translation: "G" <u>does not equal</u> "G"?

CONCLUSION: Use "!=".

8 0
2 years ago
Which of the following statements are true about the growth of technology? Select 3 options.
love history [14]

Answer:

1. Currently, 67% of people on earth use at least one mobile device.

2. The general public began connecting to the Internet when the World Wide    Web was introduced in 1991.

3. By 1995, almost half of the world’s population was connected to the Internet.

Explanation:

I just took the test ;)

5 0
2 years ago
Read the attached paper titled A Survey of Coarse-Grained Reconfigurable Architecture and comment on it. Make sure to specifical
Pani-rosa [81]

Answer:

lol

Explanation:

I NEED POINTS

5 0
1 year ago
Other questions:
  • U.S. industries like steel, computers, and energy need to be protected from foreign competition to ensure which of the following
    6·2 answers
  • The overall purpose of CSS is to modify the way web pages look without modifying the underlying HTML code. way tables render in
    12·2 answers
  • Does the Boolean expression count &gt; 0 and total / count &gt; 0 contain a potential error? If so, what is it?
    8·1 answer
  • Why can a failure in a database environment be more serious than an error in a nondatabase environment?
    15·2 answers
  • Recall the problem of finding the number of inversions. As in the text, we are given a sequence of n numbers a1, . . . , an, whi
    8·1 answer
  • Write a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. Fo
    12·1 answer
  • For his class project, Matt has to create an image in a color scheme that has shade or tint variations of the same hue. Which co
    7·1 answer
  • Java Programming home &gt; 1.14: zylab training: Interleaved input/output Н zyBooks catalog Try submitting it for grading (click
    6·1 answer
  • A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated. (1) Ou
    15·1 answer
  • When considering server consolidation, plan on running ___________ vCPUs per core.a. 1 to 2b. 3 to 4c. 4 to 6d. 6 to 8
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!