subject

In Big-Θ notation, analyze the running time of the following pieces of code/pseudo-code. Describe the running time as a function of the input size (here, n)

int *a = new int [10]; // new is O(1)
int size = 10;
for (int i = 0; i < n; i ++)
{
if (i == size)
{
int newsize = 3*size/2;
int *b = new int [newsize]; // new is O(1)
for (int j = 0; j < size; j ++) b[j] = a[j];
delete [] a; // delete is O(1)
a = b;
size = newsize;
}
a[i] = i*i;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:40
5. illustrate how fine-line inventory classification can be used with product and market segments. what are the benefits and considerations when classifying inventory by product, market, and product/market?
Answers: 2
question
Computers and Technology, 22.06.2019 13:00
Write a program which asks you to enter a name in the form of first middle initial last. so you might enter for example samuel p. clemens. use getline to read in the string because it contains spaces. also, apparently the shift key on your keyboard doesn’t work, because you enter it all lower case. pass the string to a function which uses .find to locate the letters which need to be upper case and use toupper to convert those characters to uppercase. the revised string should then be returned to main in the form last, first mi where it will be displayed.
Answers: 1
question
Computers and Technology, 22.06.2019 14:30
What percentage of companies is projected to use social media to locate new employees in 2012
Answers: 2
question
Computers and Technology, 22.06.2019 16:30
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 2
You know the right answer?
In Big-Θ notation, analyze the running time of the following pieces of code/pseudo-code. Describe th...
Questions
question
Mathematics, 11.08.2021 23:00
question
English, 11.08.2021 23:00
question
Mathematics, 11.08.2021 23:00
question
Mathematics, 11.08.2021 23:00
question
History, 11.08.2021 23:00
question
History, 11.08.2021 23:00
question
Mathematics, 11.08.2021 23:10
question
Mathematics, 11.08.2021 23:10
Questions on the website: 13722367