Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To solve the above question, the professor told me to use the property that the expected height of a randomly built binary search tree on

image text in transcribed

To solve the above question, the professor told me to use the property that the expected height of a randomly built binary search tree on n distinct keys is O(log n). I know the proof of that, however, I don't know how to visualize the binary search algorithm in the given question into subproblems forming a binary search tree. Can you help me how to get there. If you have an alternative solution for this that would help too.

Consider the following silly randomized variant of binary search. You are given a sorted array A of n integers and the integer v that you are searching for is chosen uniformly at random from A. Then instead of comparing v with the value in the middle of the array, the randomized binary search variant chooses a random number r from 1 to n and it compares v with A[r. Depending on whether v is larger or smaller, this process is repeated recursively on the left sub-array or the right sub-array, until the location of v is found. Prove a tight bound on the expected running time of this algorithm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

=+What do they need to hear?

Answered: 1 week ago