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...
-
The ocean floor is underlain by a layer of basalt that constitutes the crust, or uppermost layer, of the Earth in that region. Below this crust is found denser periodotite rock, which forms the...
-
Sanchez Corporation runs two convenience stores, one in Connecticut and one in Rhode Island. Operating income for each store in 2007 is as follows: The equipment has a zero disposal value. In a...
-
The spillway of a dam is \(20.0 \mathrm{ft}\) wide and has a flow rate of \(5000 \mathrm{ft}^{3} / \mathrm{s}\). The spillway makes an angle of \(30^{\circ}\) with the horizontal. Find the vertical...
-
Jerry Rice and Grain Stores has $4,780,000 in yearly sales. The firm earns 4.5 percent on each dollar of sales and turns over its assets 2.7 times per year. It has $123,000 in current liabilities and...
-
Construct the mathematical function that describes the movement of the piston. 1.Relevant calculations and construction of the algebraic model. Parameter adjustment If the distance d that the piston...
-
Santana Rey created Business Solutions on October 1, 2020. The company has been successful, and its list of customers has grown. To accommodate the growth, the accounting system is modified to set up...
-
The assets and UCC balances for K Ltd. (a public corporation) are listed below Asset UCC Balance, End of 2022 Class 1 (4%) building purchased in 2011 $100,000 Class 10 Delivery van 15,000 Class 8...
-
Zach Ltd. produced the following data for the year 2015 - o Interest Income $4,650,000 o Capital Gain realized $50,000 o Dividend Income from company's 15% ownership in XYZ Ltd. $65,000 o Corporate...
-
A firm is 40% financed by debt with a yield-to-maturity of 8.5%. The equity has a beta of 1.3, the market risk premium is 8.4% and the risk-free rate is 3.8%. What is the firm's WACC if the tax rate...
-
Using the database of the SDG index and the data of the Sustainable Development Report , analyze the implementation progress of SDGs in a country of your choice. https://dashboards.sdgindex.org/map ...
-
Q1: The circuit show three resistors R, R2, and R3 as shown below. Find the following (a) The total voltage gain in the circuit? (b) What is the equivalent resistor in the circuit? (c) What is the...
-
The new customer sales procedure is implemented and after 6 months all but 1 staff member has embraced the new sales process. They have a clear understanding of what's required and Jean is starting...
-
Using the annexes provided (specially #5), compare financial ratios over the years. Prepare an analysis for each ratio working for the years 2014 to 2017. a. How do the liquidity ratios compare for...
-
Which provision could best be justified as encouraging small business? a. Ordinary loss allowed on $ 1244 stuck. b. Percentage depletion. c. Domestic production activates deductions. d. Interest...
-
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...
-
If so, is it similar to one of the three formats illustrated in this chapter? If not, how is it different?
-
Do you know about the chart of accounts in your organization as it pertains to information you receive?
-
If so, did you receive the information in a formal seminar or in an informal manner, oneon-one with another individual? Do you think this was the best way? Why?
Study smarter with the SolutionInn App