Question

The following is the routine PLOOVIN, a critical component of nothing in particular. Derive a recurrence...

The following is the routine PLOOVIN, a critical component of nothing in particular. Derive a recurrence for the time complexity of PLOOVIN, and express that time complexity in Θ-notation. Do not worry about floors and ceilings.

int PLOOVIN(A, left, right) if (right - left < 4) {

return 1; }

int sum = 0;
for(int i=left; i<right; i++) {

for(int j = i+1; j<right; j++) {

sum = sum + A[i] * A[j];

}

sum = sum + A[i];

}

int mid = (left + right) / 2;

int qone = (left + mid) / 2;

int qtwo = (mid + right) / 2;

plooA = PLOOVIN(A, left, mid);

plooB = PLOOVIN(A, qone, two);

plooC = PLOOVIN(A, mid, right);

int min = plooA;

if(plooB < min) {

min = plooB;

}

if(plooC < min) {

min = plooC;

}

return sum - min;

Homework Answers

Answer #1

If you like the solution please give it a thumbs up. And if you have any query please let me know in the comments.

Solution :-

Recurrence for time complexty ->

T(n) = T(n/4) + T(n/2) + T(n/4) + n2  = 2.T(n/4) + T(n/2) + n2

Here quadratic term is for nested loops and other T(x) terms for 3 recursive calls.

If we try to solve this recurrence using recursive tree method then there will be two brances, one from T(n/4) and other from T(n/2) term, having approx. heights of log4N and log2N . That we can summarize both to the log2N .

So now time complexity will be in terms of N2logN, where N is size of array A.

Time complexity = Θ(N2logN)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The following algorithm finds the initial substring of y that can be reversed and found in...
The following algorithm finds the initial substring of y that can be reversed and found in y. For example, longestInitialReverseSubstringLength(“aabaa”) = 5, because “aabaa” is the same string forwards and backwards, so the longest initial substring that can be reversed and found in the string is “aabaa”. Also, longestInitialReverseSubstringLength(“bbbbababbabbbbb”) is 6, because “babbbb” can be found in the string (see color-highlighted portions of the string), but no longer initial string exists reversed in any part of the string. longestInitialReverseSubstringLength(String y)...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
The questions: 1. What type of technology Acme and Omega utilize to transform inputs into outputs?...
The questions: 1. What type of technology Acme and Omega utilize to transform inputs into outputs? 2. Which strategic choice (differentiation or cost leadership) suits best to Acme? Omega? Do these companies have clear strategic choices or do they stuck in the middle? 3. Based on all the contingencies which type of structure is more suitable for these companies; mechanistic or organic? please answer each question alone The Paradoxical Twins: Acme and Omega Electronics John F. Veiga Part! boom of...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old man of Scandinavian descent was rushed to the Emergency Room of your local hospital after a family member discovered him unconscious in his home. The woman who dialed “911” told the dispatcher that the man, her brother, was the local librarian of the past 10 years and had no spouse or children. She reported that they had spoken the day before, and he had...
Team 5 answer the questions What are 4 key things you learned about the topic from...
Team 5 answer the questions What are 4 key things you learned about the topic from reading their paper? How does the topic relate to you and your current or past job? Critique the paper in terms of the organization and quality. Incentive Systems             In this paper, we will focus primarily on financial rewards that companies use to attract, retain and motivate the brightest and most talented candidates in the labor market. By providing a reward system that...
Please summarize the below article in approximately 100 words: Monumental function in British Neolithic burial practices...
Please summarize the below article in approximately 100 words: Monumental function in British Neolithic burial practices Ian Kinnes The high-risk rate of survival for the non-megalithic series of Neolithic funerary monuments, recently re-emphasized by Piggott (1973: 34), introduces a further variable into the deductive study of burial practices. In Britain and Europe the overall distribution of monumental forms present both lacunae and a marked preponderance of cairns over earthen mounds which are in ill accord with the known or predicted...
What role could the governance of ethics have played if it had been in existence in...
What role could the governance of ethics have played if it had been in existence in the organization? Assess the leadership of Enron from an ethical perspective. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies, collapsed in 2001 under a mountain of debt...
Discuss ethical issues that can be identified in this case and the mode of managing ethics...
Discuss ethical issues that can be identified in this case and the mode of managing ethics Enron finds itself in this case. How would you describe the ethical culture and levels of trust at Enron? Provide reasons for your assessment. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT