Suppose our list of increasing integers is shown in the table below 2346791214 Suppose we conduct...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Suppose our list of increasing integers is shown in the table below 2346791214 Suppose we conduct the binary search algorithm on this list where we search for 12. (a) In the language of the algorithm above, enter the correct values for the following variables for this particular search (where n is the length of the list): t = 12 L = n = 14 (b) After the first iteration of the while loop, what are the values of the following variables? ⒸA. 7 B. 2 a[3] OC6 OD+ OE. 12 OE 14 OG.9 OH. 3 a[1] = R= (c) Intuitively, after the first iteration of the while loop, we have cut down our search to a set S of roughly half of the original numbers on the list. Check the numbers that are in the set S after the first iteration of the while loop: S has the following elements: Am= (d) After the second iteration of the while loop, some of the variables have altered valu Enter the values of the following variables after the second while loop iteration: R= m= Ask Anr def Binary Search (a, t): L = 0 R = len(a) - 1 while L <= R: m = floor((L + R)/2) if a[m] <t: L = m+ 1 elif a[m] > t : R = m - 1 t = 12 else: return m return -1 Suppose our list of increasing integers is shown in the table below. 2346791214 Suppose we conduct the binary search algorithm on this list where we search for 12. (a) In the language of the algorithm above, enter the correct values for the following variables for this particular search (where n is the length of the list): n = 14 a[3] = a[1] = S has the following elements: ⒸA. 7 OB. 2 OC.6 OD 4 OE. 12 OE 14 OG.9 H. 3 (d) After the second iteration of the while loop, some of the variables have altered values. Enter the values of the following variables after the second while loop iteration: AR= L= (e) After the third iteration of the while loop, some of the variables have altered values. Enter the values of the following variables after the third while loop iteration: L = = 4. Submit answer m= R= (f) After the 3rd iteration of the while loop, the while loop terminates and the function returns a value. Enter the return value in this case: return value Answers (in progress) m= Suppose our list of increasing integers is shown in the table below 2346791214 Suppose we conduct the binary search algorithm on this list where we search for 12. (a) In the language of the algorithm above, enter the correct values for the following variables for this particular search (where n is the length of the list): t = 12 L = n = 14 (b) After the first iteration of the while loop, what are the values of the following variables? ⒸA. 7 B. 2 a[3] OC6 OD+ OE. 12 OE 14 OG.9 OH. 3 a[1] = R= (c) Intuitively, after the first iteration of the while loop, we have cut down our search to a set S of roughly half of the original numbers on the list. Check the numbers that are in the set S after the first iteration of the while loop: S has the following elements: Am= (d) After the second iteration of the while loop, some of the variables have altered valu Enter the values of the following variables after the second while loop iteration: R= m= Ask Anr def Binary Search (a, t): L = 0 R = len(a) - 1 while L <= R: m = floor((L + R)/2) if a[m] <t: L = m+ 1 elif a[m] > t : R = m - 1 t = 12 else: return m return -1 Suppose our list of increasing integers is shown in the table below. 2346791214 Suppose we conduct the binary search algorithm on this list where we search for 12. (a) In the language of the algorithm above, enter the correct values for the following variables for this particular search (where n is the length of the list): n = 14 a[3] = a[1] = S has the following elements: ⒸA. 7 OB. 2 OC.6 OD 4 OE. 12 OE 14 OG.9 H. 3 (d) After the second iteration of the while loop, some of the variables have altered values. Enter the values of the following variables after the second while loop iteration: AR= L= (e) After the third iteration of the while loop, some of the variables have altered values. Enter the values of the following variables after the third while loop iteration: L = = 4. Submit answer m= R= (f) After the 3rd iteration of the while loop, the while loop terminates and the function returns a value. Enter the return value in this case: return value Answers (in progress) m=
Expert Answer:
Answer rating: 100% (QA)
The binary search algorithm provided will be applied to the array 2 3 4 6 7 9 12 14 to find the inde... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
Why is sustainability in the sport industry linked to the green movement? What legislative actions currently being considered in Congress might affect the financial management of sport?
-
Assignment 5: Hash Table implementation andconcordance There are three parts to this assignment. In the first two parts,you will complete the implementation of a hash map and aconcordance program. In...
-
Create a binary treethat performs a Depth First Search (DFS). Python I was provided the following Python code and the data to createa binary tree that performs a Depth First Search (DFS). Pleasedon't...
-
JOB SHEETS: Job cost sheets for each of the ten jobs appear on this sheet. Additionally, a combo box for each job (ten combo boxes total) appears for each job. Further, on this sheet, a check box...
-
A settling tank for a municipal water supply is 2.5 m deep, and 20°C water flows through continuously at 35 cm/s. Estimate the minimum length of the tank which will ensure that all sediment (SG...
-
Find the volume of the solid obtained by revolving the ellipse b2x2 + a2y2 = a2b2 about the y-axis.
-
In a recent study on risk factors for strokes, the American Heart Association (AHA) collected data on age, systolic blood pressure, diastolic blood pressure, and risk of stroke; risk is interpreted...
-
A mining corporation purchased $120,000 of production machinery and depreciated it using SOYD depreciation , a 5-year depreciable life, and zero salvage value . The corporation is a profitable one...
-
Target Co. has sales of $93,561 million, net income of $4,368 million, a total asset turnover of 1.8 and an equity multiplier of 3.55. Based on the given information, what is its return on equity?
-
Lydia Hartley, manager of UltraProducts New Zealand Division, is trying to set the production schedule for the last quarter of the year. The New Zealand Division had planned to sell 100,000 units...
-
Show the top 3 directors with the best movie ratings. This SQL query results in the AVG(rating.rev_rating) column showing results which only say AVG(rating.rev_rating) rather than a numerical result....
-
Applied Economics (Give me examples of poster-picture then explain) DIRECTION: Look, and observe the economy that the Philippines has, on a 1/8 illustration board make a poster about Philippine's...
-
Fickel Company has two manufacturing departments-Assembly and Testing & Packaging. The predetermined overhead rates in Assembly and Testing & Packaging are $16.00 per direct labor-hour and $12.00 per...
-
In order to evaluate the suitability of these personality measures for inclusion in your company's planned selection process, you need to evaluate how well they predict performance. Your boss has...
-
The December 3 1 , 2 0 2 4 , unadjusted trial balance for Demon Deacons Corporation is presented below. \ table [ [ Accounts , Debit,Credit ] , [ Cash , $ 8 , 0 0 0 , ] , [ Accounts Receivable, 1 3 ,...
-
Answer the essay question with in-depth explanations and provide text evidence (such as quotes) as if possible Essay Question: John Keats once suggested that truly artistic people are capable "of...
-
Quer The end links of uniform chain of length I can glide on two Amouth rods in the name vertical plane which are include in eppoite direction at Equal angle of to the verticle prove that in the...
-
Using the parallel-axis theorem, determine the product of inertia of the area shown with respect to the centroidal x and y axes. 6 in. 9 in. 9 in- 4.5 in. in. 4.5 in.
-
How would you modify QUICK SORT to sort into non increasing order?
-
Show that the golden ratio and its conjugate both satisfy the equation x 2 = x + 1.
-
For the set of {1, 4, 5, 10, 16, 17, 21} of keys, draw binary search trees of heights 2, 3, 4, 5, and 6.
-
As the Human Resources manager for Beautiful Bottles Pty Ltd, a company manufacturing bottles for the food industry, you have been asked by the accountant to help reduce the product costs of each...
-
Innovative Computers Pty Ltd produces laptops. Each laptop contains a rechargeable battery and LCD screen. Batteries and screens are purchased from an outside supplier for \($192\) and \($300\) each,...
-
As the marketing manager for Smart Fones Industries Pty Ltd you have asked the accountant what it costs to make the SFI2026 model as you want to set a price for the phone. A similar phone produced by...
Study smarter with the SolutionInn App