Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that implements bisection search on a given list. For this part, you need to use the same list containing the 10,000 random

Write a function that implements bisection search on a given list. For this part, you need to use the same list containing the 10,000 random elements which you used in the previous exercise.

This function should take inputs as:

a number to be searched in the list,

and the list itself.

The output is true or false and the time required to perform that search:

if the number is found in the list return true, otherwise return false.

Also, measure the time needed to run this function and compare it with linear search.

Note that to use bisection search, the list should be sorted (otherwise, you may not get a correct result).

Therefore, before calling bisection search function, you need to sort the list first to make sure that the input is sorted (you can use built-in sort function for the list; i.e. L.sort() which will perform in-place sort)

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

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

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions