For each pair of function listed below state if A(n) = O(B(n)), or B(n) = O(A(n))...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For each pair of function listed below state if A(n) = O(B(n)), or B(n) = O(A(n)) or A(n) = (B(n)). Justify your answer. A(n)= n0 and B(n) = n log00 n A(n) = n log n and B(n) = n ln n A(n) = 2log n and B(n) = 100n . Solve the following recurrences. Justify your answer. T(n)= 3T(n/4) + O(n) T(n) = 5T(n/5) + O(n) T(n) = 2T(n/2) + n . For all the following statements, say if they are TRUE or FALSE. Justify your answer. Merge-Sort runs in linear time Quick-Sort runs in O(n log n) in the worst case Bubble-Sort runs in quadratic time in the worst case You are given n integers in the range 0 to k. Your goal is to build a data structure D that allows to answer any query about how many of the n integers fall into a particular range [a, b] in constant time. Show how to build such data structure in O(n + k) time. Example: Your have 15 integers between 0 and k = 7. Let them be [7,5,2,3,2,1,5,6,4,7,0,4, 1, 5,3] When you query [3, 6] the algorithm should return 8 (since there are that many integers between 3 and 6). Hint: Use a modification of Counting-Sort. Problem 5 Consider a hash table of size m with n values in it where collisions are resolved by chaining. Assuming Simple Uniform Hashing each slot will have an expected chain of length a = n/m Remember that in this case Insertion costs O(1) and Search and Delete cost o(a). Now assume that you want to keep the lists in sorted order. How would those costs change? For each pair of function listed below state if A(n) = O(B(n)), or B(n) = O(A(n)) or A(n) = (B(n)). Justify your answer. A(n)= n0 and B(n) = n log00 n A(n) = n log n and B(n) = n ln n A(n) = 2log n and B(n) = 100n . Solve the following recurrences. Justify your answer. T(n)= 3T(n/4) + O(n) T(n) = 5T(n/5) + O(n) T(n) = 2T(n/2) + n . For all the following statements, say if they are TRUE or FALSE. Justify your answer. Merge-Sort runs in linear time Quick-Sort runs in O(n log n) in the worst case Bubble-Sort runs in quadratic time in the worst case You are given n integers in the range 0 to k. Your goal is to build a data structure D that allows to answer any query about how many of the n integers fall into a particular range [a, b] in constant time. Show how to build such data structure in O(n + k) time. Example: Your have 15 integers between 0 and k = 7. Let them be [7,5,2,3,2,1,5,6,4,7,0,4, 1, 5,3] When you query [3, 6] the algorithm should return 8 (since there are that many integers between 3 and 6). Hint: Use a modification of Counting-Sort. Problem 5 Consider a hash table of size m with n values in it where collisions are resolved by chaining. Assuming Simple Uniform Hashing each slot will have an expected chain of length a = n/m Remember that in this case Insertion costs O(1) and Search and Delete cost o(a). Now assume that you want to keep the lists in sorted order. How would those costs change?
Expert Answer:
Answer rating: 100% (QA)
Answer Comparing An and Bn An n10 Bn n logn Answer An OBn Justification In the big O notation n10 gr... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
2. Make a one-dimensional array with 15 integers. Using an enhanced for loop complete the following tasks: a. Use the following numbers: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30) b....
-
For each of the following statements say whether they are true or false and explain why. (a) If training is truly unrelated to stress (Cortisol) levels, a larger study would have more power than a...
-
For each pair of function in Exercise f(x) = 2x + 3, g(x) = 3 - 5x (a) Find the domain of f, g, f + g, f - g, fg, f f, f/g, and g/f. (b) Find (f + g) (x), (f- g) (x), (fg) (x), (ff) (x), (f/g) (x),...
-
One analogy that is used to think about what is happening in an electric circuit is that of a bucket brigade. Bucket brigades were used before 1900 to fight fires. A group of people would each have a...
-
Miami, Inc., planned and actually manufactured 250,000 units of its single product in 2017, its first year of operation. Variable manufacturing cost was $19 per unit produced. Variable operating...
-
What is the limitation of duration-based hedging?
-
Using divisibility rules, determine if 245 is divisible by 5.
-
Consider the following LP problem: Maximize profit = 5X + 6Y Subject to 2X + Y 120 2X + 3Y 240 X, Y 0 (a) What is the optimal solution to this problem? Solve it graphically. (b) If a technical...
-
Oriole Clothiers Ltd.'s current dividend is $4.00. Dividends are expected to grow by 7 percent for years 1 to 3, 5 percent for years 4 to 7, and 1 percent thereafter. The required rate of retur...
-
Determine the maximum power delivered to the variable resistor R shown in the circuit of Fig. 4.136. 2 Vx 10 (4 20 20 : 10 . www
-
2.21 Four concurrent forces act on the center of mass of a landing airplane. Calculate the resultant force and the angle it makes with the ax axis. F3 = 500 lb F = 2000 lb 45 30 F = 1000 lb F4 = 2000...
-
List advantages of stable models.
-
Justify the existence of the following classes in negotiation stable model. a. AnyAgreement b. AnyMedia c. AnyContext d. AnyParty
-
Explain the classification of analysis patterns based on the methodology of construction. Briefly describe each category.
-
What are the advantages of using stability approach over direct and analogy approach?
-
What does a pattern representa complete system or a specific commonly occurring problem?
-
Balance Sheet 000 Balance Sheet (18000) income Statement D (18.000) Statement of Cash Flows #0 Statement of Cash Flows * (8.000 Balance Sheet G (8.000) Income Statement H8,000 Balance Sheet
-
If there is an unrealized holding gain on available-for-sale investments, it is reported as?
-
Mike sells his home to Jane on April 2, 2012. Jane pays the property taxes covering the full calendar year in October, which amount to $2,500. How much may Mike and Jane each deduct for property...
-
Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is...
-
In 2012, Lou has a salary of $54,000 from her job. She also has interest income of $1,700. Lou is single and has no dependents. During the year, Lou sold silver coins held as an investment for a...
-
On the Internet, find sites describing examples of the bill-and-hold technique.
-
Search the Internet for Thomas M. Coughlin, former Wal-Mart vice-chairman. What was he accused of in April 2005? What was his annual compensation in 2004?
-
Search the Internet for the improper transactions incurred by the A.I.G. What happened to the chairman Maurice R. Greenberg?
Study smarter with the SolutionInn App