For the implementation, use your own code for all its components no special library or...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
I can provide you with a Python implementation of the described search strategy and a pure binary se... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
What kind of software is a CAD porgram Securtiy Graphics and media Communication Malware
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The English publisher of a book called Cambridge gave a New York publisher permission to sell that book any place in the world except in England. The New York publisher made several bulk sales of the...
-
Air flows at Ma = 2.5 past a half wedge airfoil whose angles are 4°, as in Fig. P9.151. Compute the lift and drag coefficients at α equal to (a) 0°; and (b) 6°. 4 Ma,"-2.5
-
1 .Calculate the average vertical shear stress at; x=4.0m, x=2.0m, x=0 (at the support). 2. Sketch the shear force diagram and indicate maximum and minimum values 3. Calculate the horizontal...
-
Consider the FS two-column configuration for the separation of methanol and water in Figure 20.2 and (a) determine the number of degrees of freedom for the overall system, (b) determine the number of...
-
EmmyLou Company purchased 70 Harris Company 12%, 10-year, $1,000 bonds on January 1, 2010, for $73,000. EmmyLou Company also had to pay $500 of brokers fees. The bonds pay interest semiannually on...
-
1. Discuss how the change in First Apparel's business strategy has likely affected the focus of its selection process for new employees. 2. Do you think the turnover problem could be related to...
-
The owner has decided to transfer a large shelving unit he owns privately to the business to be used as display shelving in the shop. The asset is to be transferred on the 30 June 2022 at its current...
-
A local supermarket has experienced a decline in unit sales and little change in rupee value sales. Profits have almost vanished. The chief executive in searching for ways to revitalize the operation...
-
In the same way, Shaun of the Dead was in conversation with previous zombie movies, Solaris is also looking back toward earlier Science Fiction films, especially 2001: A Space Odyssey. Locate a...
-
A shoe seller sold shoes worth 1 6 0 TL on the first day, 1 9 2 TL on the second day and 1 4 4 TL on the third day at the some price . At was t how many shoes were sold by the seller in 3 days?
-
A box without a lid is made from a 2/3-inch-thick piece of wood. The interior length will be 6 feet, the interior width will be 3 feet, the interior depth will be 4 feet, Determine the approximate...
-
Ace Superstore, a retail grocery outlet in Soweto, has seen substantial growth in revenue and profit over the past year. As a result of this growth, the board have voted to expand operations by...
-
2. Currency pegging refers to the practice of locking a currency's exchange rate to another country's currency. As it has its own merits and drawbacks, express your opinion to agree or disagree on...
-
Placental alkaline phosphatase is marker of: a) Theca cell tumor b) Teratoma c) Choriocarcinoma d) Dysgerminoma
-
Using (1) or (2), find L(f) if f(t) if equals: t cos 4t
-
Mallory Corporation has a calendar year-end. The corporation has paid estimated payments of $10,000 during 2012 but still owes an additional $5,000 for its 2012 tax year. a. When is the 2012 tax...
-
Jim is fired from his job as a waiter and decides to take an extended trip to Europe. After touring Europe for 3 months, Jim returns to look for a new job as a waiter. Are his job-hunting expenses...
-
In 2012, Lou has a salary of $54,000 from her job. She also has interest income of $1,700. Lou is single and has no dependents. During the year, Lou sold silver coins held as an investment for a...
-
Pegasus Veterinary Hospital (PVH) is a partnership of five veterinarian surgeons who specialize in treating horses. PVH is located in a $25 million facility on 20 acres of land, employing over 40...
-
A tender evaluation method specifies 60% price and 40% quality. What is the weighted score of a tender that scored 80 points (out of 100) for price and 60 for quality?
-
You are a recently appointed purchasing manager who is overseeing terms and con- ditions of contract for an important international purchase with a UN country. What rules should you be particularly...
Study smarter with the SolutionInn App