9. What is the time complexity of the following algorithm? Assume that the number of elements...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
9. What is the time complexity of the following algorithm? Assume that the number of elements in array A is equal to N. A: array of numbers low: lowest index of array (0) mid: index of array A, low <mid < high high: highest index of array A (Number of elements -1) function F(A, Low,mid, high) for 8< i <=mid 1 2 3 NESETERGEESTLASE 10 11 12 13 14 15 16 17 18 19 20 21 22 B[i]=A[1] for 8 i< (high-mid) O Theta(N) C[i]=A[i+mid+1] i=0; j=0; k=0 while( i cemid AND j<(high-mid)) if(B[i]<C[j]) A[k] =B[1] i=i+1 Theta(2*N) else k=k+1 if(i>mid) A[k] =C[j] j=j+1 for j<n< high-mid A[k]=C[m] k=k+1 if(j= (high-mid)) end function for i<m <mid+1 A[k] B[m] k=k+1 Theta (NlogN) Onone of the others O Theta(logN) 9. What is the time complexity of the following algorithm? Assume that the number of elements in array A is equal to N. A: array of numbers low: lowest index of array (0) mid: index of array A, low <mid < high high: highest index of array A (Number of elements -1) function F(A, Low,mid, high) for 8< i <=mid 1 2 3 NESETERGEESTLASE 10 11 12 13 14 15 16 17 18 19 20 21 22 B[i]=A[1] for 8 i< (high-mid) O Theta(N) C[i]=A[i+mid+1] i=0; j=0; k=0 while( i cemid AND j<(high-mid)) if(B[i]<C[j]) A[k] =B[1] i=i+1 Theta(2*N) else k=k+1 if(i>mid) A[k] =C[j] j=j+1 for j<n< high-mid A[k]=C[m] k=k+1 if(j= (high-mid)) end function for i<m <mid+1 A[k] B[m] k=k+1 Theta (NlogN) Onone of the others O Theta(logN) 9. What is the time complexity of the following algorithm? Assume that the number of elements in array A is equal to N. A: array of numbers low: lowest index of array (0) mid: index of array A, low <mid < high high: highest index of array A (Number of elements -1) function F(A, Low,mid, high) for 8< i <=mid 1 2 3 NESETERGEESTLASE 10 11 12 13 14 15 16 17 18 19 20 21 22 B[i]=A[1] for 8 i< (high-mid) O Theta(N) C[i]=A[i+mid+1] i=0; j=0; k=0 while( i cemid AND j<(high-mid)) if(B[i]<C[j]) A[k] =B[1] i=i+1 Theta(2*N) else k=k+1 if(i>mid) A[k] =C[j] j=j+1 for j<n< high-mid A[k]=C[m] k=k+1 if(j= (high-mid)) end function for i<m <mid+1 A[k] B[m] k=k+1 Theta (NlogN) Onone of the others O Theta(logN)
Expert Answer:
Answer rating: 100% (QA)
The detailed answer for the above question is provided below So the correct answer i... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Identify a local, geographical, national, or world event, system, or structure that provides examples of racism, sexism, ableism, ageism, or any of the other "isms" that demonstrate the need for...
-
Identify the Possible Threat to Internal Validity Using "MR SMITH ID" 5 Points Possible (Fall - 2023) Instructions: Below is a description of a study based on the famous Albert Bandura "Bobo Doll"...
-
In using the bolt cutter shown, a worker applies two 300-N forces to the handles. Determine the magnitude of the forces exerted by the cutter on the bolt. 300 N 12 mm 24 mm E 24 mm 460 mm 96 mm 300 N...
-
What is the reward-to-volatility ratio of the best feasible CAL? A pension fund manager is considering three mutual funds. The first is a stock fund, the second is a long-term government and...
-
How social media and integrated marketing communication work for business what's the benefits and how we can recognize right media choices, for business. Discuss the types of coupons we have used...
-
Carter Roofing, Corp., was recently formed as a corporation. The balance of each item in the companys accounting equation is shown for December 1 and for each of the following business days....
-
How are operating expenses (not included in cost of goods sold) handled under the installment-sales method of accounting? What is the justification for such treatment?
-
Two examples of unprofessional behaviors and reasoning as to why they are unprofessional for lawyers. Two examples of professional behaviors and reasoning as to the importance of maintaining...
-
Salazar Company is a job-order costing firm that uses activity-based costing to apply overhead to jobs. Salazar identified three overhead activities and related drivers. Budgeted information for the...
-
You purchase a magic crystal ball for $23,000 and go into the fortune-telling business. In the first year after the purchase you make $6000. This amount increases $500 per year for each of the next...
-
Stadium Company has two manufacturing departments, Forming and Painting. The company uses the weighted-average method and it reports the following data. Units completed in the Forming department are...
-
Consider two points in an electric field. The potential at point 1 , V 1 , is 3 1 V . The potential at point 2 , V 2 , is 1 8 6 V . A proton is moved from point 1 to point 2 . (a) Write an equation...
-
My name is Linda Jackson and I currently live in Shreveport, LA which is my hometown. I decided to return home after 40 years of living in Dallas, Germany, and Tallahassee, Florida. I have a...
-
A company has fixed costs of $104,000 and it can produce 920 items for a total cost of $108,600. Find the linear cost function, C (x)
-
On January 1, 2025, Cullumber Co. issued ten-year bonds with a face value of $5,625,000 and a stated interest rate of 10%, payable semiannually on June 30 and December 31. The bonds were sold to...
-
A load P is applied at the end of a rigid beam that is just sufficient to close the gap between the rigid beam and the top of the column (2) at C. Then, the load P is increased until 2 = 1230 . [a =...
-
Consider the sections of two circuits illustrated above. Select True or False for all statements.After connecting a and b to a battery, the voltage across R1 always equals the voltage across R2.Rcd...
-
One possible method of determining a social preference relation is the Borda count, also known as rank-order voting. Each voter is asked to rank all of the alternatives. If there are 10 alternatives,...
-
Mario has a small garden where he raises eggplant and tomatoes. He consumes some of these vegetables, and he sells some in the market. Eggplants and tomatoes are perfect complements for Mario, since...
-
The Miss Manners Refinery in Dry Rock, Oklahoma, converts crude oil into gasoline. It takes 1 barrel of crude oil to produce 1 barrel of gasoline. In addition to the cost of oil there are some other...
-
Think of an organizationa place of employment, a club, a sports team, a musical group, an academic societythat provided you with a significant work experience, and answer the following questions. 1....
-
What factors determine whether behavior in organizations is ethical or unethical? Divide up into small groups, and each person think of some unethical behaviors or incidents that you have observed in...
-
Now that you understand the nature of OB and management, and the kinds of issues they address, debate the following topic: Team A. The best way to increase organizational effectiveness is to clearly...
Study smarter with the SolutionInn App