Question

Suppose that, even unrealistically, we are to search a list of 700 million items using Binary Search, Recursive (Algorithm 2.1). What is the maximum number of comparisons that this algorithm must perform before finding a given item or concluding that it is not in the list

“Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a problem into n subinstances of size n/3, and the dividing and combining steps take linear time. Write a recurrence equation for the running time T(n), and solve this recurrence equation for T(n). Show your solution in order notation.”

34. What is the time complexity T(n) of the nested loops below? For simplicity, you may assume that n is a power of 2, That is, n = 2k for some positive integer k. z = n; while (i>= 1){ while i > j = i; while (j <= n){ while loop > //Needs Θ(1). < body of th j=2*j; e e while 100 i = Li/2] ;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Add a comment
Know the answer?
Add Answer to:
Suppose that, even unrealistically, we are to search a list of 700 million items using Binary...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a...

    Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a problem into 5 sub-instances of size n/3, and the dividing and combining steps take a time in Θ(n n). Write a recurrence equation for the running time T (n) , and solve the equation for T (n) 2. Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a problem into 5 sub-instances of size n/3, and the dividing...

  • We know that binary search on a sorted array of size n takes O(log n) time....

    We know that binary search on a sorted array of size n takes O(log n) time. Design a similar divide-and-conquer algorithm for searching in a sorted singly linked list of size n. Describe the steps of your algorithm in plain English. Write a recurrence equation for the runtime complexity. Solve the equation by the master theorem.

  • Suppose we are given two sorted arrays (nondecreasing from index 1 to index n) X[1] ·...

    Suppose we are given two sorted arrays (nondecreasing from index 1 to index n) X[1] · · · X[n] and Y [1] · · · Y [n] of integers. For simplicity, assume that n is a power of 2. Problem is to design an algorithm that determines if there is a number p in X and a number q in Y such that p + q is zero. If such numbers exist, the algorithm returns true; otherwise, it returns false....

  • Language = c++ Write a program to find the number of comparisons using the binary search...

    Language = c++ Write a program to find the number of comparisons using the binary search and sequential search algorithms as follows: o Suppose list is an array of 1000 elements. o Use a random number generator to fill the list. o Use the function insertOrd to initially insert all the elements in the list. o You may use the following function to fill the list: void fill(orderedArrayListType& list) {       int seed = 47; int multiplier = 2743;                                ...

  • Suppose the following is a divide-and-conquer algorithm for some problem. "Make the input of size n...

    Suppose the following is a divide-and-conquer algorithm for some problem. "Make the input of size n into 3 subproblems of sizes n/2 , n/4 , n/8 , respectively with O(n) time; Recursively call on these subproblems; and then combine the results in O(n) time. The recursive call returns when the problems become of size 1 and the time in this case is constant." (a) Let T(n) denote the worst-case running time of this approach on the problem of size n....

  • The following algorithm (Rosen pg. 363) is a recursive version of linear search, which has access...

    The following algorithm (Rosen pg. 363) is a recursive version of linear search, which has access to a global list of distinct integers a_1, a_2,..., a_n. procedure search(i, j, x : i,j, x integers, 1 < i < j < n) if a_i = x then return i else if i = j then 4. return 0 else return search(i + 1, j, x) Prove that this algorithm correctly solves the searching problem when called with parameters i = 1...

  • 1. Randomized Binary Search Which are true of the randomized Binary Search algorithm? Multiple answers:You can...

    1. Randomized Binary Search Which are true of the randomized Binary Search algorithm? Multiple answers:You can select more than one option A) It uses a Variable-Size Decrease-and-Conquer design technique B) Its average case time complexity is Θ(log n) C) Its worst case time complexity is Θ(n) D) It can be implemented iteratively or recursively E) None of the above 2. Randomized Binary Search: Example Assume you have an array, indexed from 0 to 9, with the numbers 1 4 9...

  • We are using sequential search to search an array of size n. It is known that...

    We are using sequential search to search an array of size n. It is known that the item we are looking is definitely present in the array. The probability that the item we are looking for is the last one in the array is 1/3. The probabilities of all other items are equal. What is the average case time complexity(counting the number of comparisons) of the algorithm in this case?

  • I posted the question for this and I want to make sure that this answers the...

    I posted the question for this and I want to make sure that this answers the question 1.a) The pseudo code for the closest pair problem is as illustrated below: Closest pair (K, i, j) input: Array K is indexed from i to j. closest pair returns the indices of the closest pairs. diff = K[2] - K[1]   // This is the initial difference between the first two numbers. This is shown through the array and these differences. example: K[2]...

  • 7. (10) Given an array of integers A[1..n], such that, for all i, 1 <i< n,...

    7. (10) Given an array of integers A[1..n], such that, for all i, 1 <i< n, we have |Ali]- Ali+1]| < 1. Let A[1] = and Alny such that r < y. Using the divide-and-conquer technique, describe in English algorithm to find j such that Alj] z for a given value z, xz < y. Show that your algorithm's running time is o(n) and that it is correct o(n) search an 2 8. (10) Solve the recurrence in asymptotically tight...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT