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)
a In the language of the algorithm above enter the correct values for the following variables for th... 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...
-
What we can learn, and what can we not learn from an organizational chart? What structural and contextual variables we study in organizational theory appear on the organizational chart?
-
World Series Champs As of this writing, the New York Yankees were the last team to win the World Series, and the numbers of the starting lineup are 2, 18, 25, 13, 20, 55, 24, 33, and 53. The average...
-
You find short time lags between deposits and withdrawals and large deposits made on Fridays. What should you suspect?
-
A condensed income statement for the Commercial Division of Maxell Manufacturing Inc. for the year ended December 31, 2014, is as follows: Sales ..............$ 3,500,000 Cost of goods sold ............
-
At September 30, the end of Beijing Company??s third quarter, thefollowing stockholders?? equity accounts are reported.Common stock, $14 par value$ 300,000Paid-in capital in excess of par v 2 answers
-
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...
-
As we have established throughout the unit, management principles impact on everything the organisation is and does and influences how effectively leaders and managers discharge their duties and...
-
Aces Incorporated, a manufacturer of tennis rackets, began operations this year. The company produced 7,050 rackets and sold 5,430. Each racket was sold at a price of $90. Fixed overhead costs are...
-
NUMBER ONE (a) Most users interact with their computer systems through a command-driven interface or graphical interface. As a person in charge of Information Technology (IT), your boss is proposing...
-
Solve the system using an augmented matrix. Show all work. x-3y=-17 2x - 6y=-26
-
400 shares outstanding of X corp I own 120 shares my grandpa owns 60 shares my mother owns 60 shares my son owns 20 shares Y Corp owns 100 shares of X Corp I own 70% of Y Corp remaining 40 shares of...
-
At the end of 2021, Lily has 33,200 units of inventory on hand. If Plan A is accepted, the 2022 ending inventory should be 29,050 units. If Plan B is accepted, the ending inventory should be equal to...
-
Klean Fiber Company is the creator of Y-Go, a technology that weaves silver into its fabrics to kill bacteria and odor on clothing while managing heat. Y-Go currently sells for $7.00 per...
-
A handrail, which weighs 120 N and is 1.8 m long. was mounted to a wall adjacent to a small set of steps (Figure P4.26). The support at A has broken, and the rail has fallen about the loose bolt at 8...
-
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.
-
Draw up a consolidated balance sheet as at 31 December 2007 from the following: At the balance sheet date, Child owes Parent 3,200. During the year Parent sold goods which had cost 6,000 to Child for...
-
You are to draw up a consolidated balance sheet as at 31 December 2005 from the following: At the balance sheet date, Son 1 owed Pa and Mum 2,500 and Son 2 1,100, and Pa and Mum owed Son 2 2,100. Pa...
-
You are presented with the following information from the Seneley group of companies for the year to 30 September 2006: Additional information: (a) The authorised, issued and fully paid share capital...
Study smarter with the SolutionInn App