Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the implementation, use your own code for all its components no special library or open source/pirated code should be used. 4. (30 marks)

For the implementation, use your own code for all its components  no special library or open source/pirated

For the implementation, use your own code for all its components no special library or open source/pirated code should be used. 4. (30 marks) Here you are required to code a variation of the binary search in a sorted list of integers. The list is implemented as an array. The search starts with a 1/5th-4/5th strategy wherein the first element compared, when searching for an item in the list, is the 'pivot' element which is at a distance of 1/5th from one end of the list(assuming the end chosen is the start of the 'remaining' list). If there is no match ('pivot' element is not equal to the search key) and if the part of the list that should be examined further for the search is 1/5th part of the list, continue with the same strategy. Whenever the part of the list that should be examined further for the search is of size 4/5th, switch to a binary search once and return to the 1/5th-4/5th strategy. Compare the performance of this strategy with the pure binary strategy by doing an experiment on at least ten lists with 1000+ elements. Tabulate the results (number of comparisons for success and failures). Compare these numbers for a pure binary search. The list could be created by first generating a random positive number and then a random positive increment for the next number (hence the list would be sorted). Search for random values which may or may not be in the list you have generated. The random values to be generated should be in the range of the values in your list.

Step by Step Solution

3.35 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

I can provide you with a Python implementation of the described search strategy and a pure binary se... 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