Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)=

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 You are given n integers in the range 0 to k. Your goal is to build a data structure D that allows to answer 

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?

Step by Step Solution

3.40 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

Answer Comparing An and Bn An n10 Bn n logn Answer An OBn Justification In the big O notation n10 gr... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

1. Walk to the child, look into his or her eyes.

Answered: 1 week ago