Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the following figure for questions 23-25 on a Binary Search where 1) list is

ID: 3914693 • Letter: U

Question

Use the following figure for questions 23-25 on a Binary Search where 1) list is split bottom to middle and middle +1 to top, 2) middle is calculated with the floor function (rounds down), and 3) the function is non-forgetful (ie. it checks the middlelndex value and returns true if that is the item): 10 11 12 17 19 21 25 23. When searching for the value 19, how many different values will middlelndex take? b. 3 d. It cannot be determined a. c, 24. When searching for the value 1, how many different values will middlelndex take? a. 1 c. 2 b. 3 d. It cannot be determined 25. When searching for the value 17, how many different values will middlelndex take? b. 3 d. It cannot be determined a. c. 4

Explanation / Answer

23. option C

explanation:

In the first search middle index value is 11 and that is the first value taken for middle index.

In the second search as 19>11 middle index value is 19 and that is the second value taken for middle index and also 19 is a search value so 'true' will be returned.

24. option b

Explanation:

In the first search middle index value is 11 and that is the first value taken for middle index.

In the second search as 1<11 middle index value is 6 and that is the second value taken for middle index.

In the third search as 1<6 middle index value is 3 and that is the third value taken for middle index.

As item not found returns false

25. option c

In the first search middle index value is 11 and that is the first value taken for middle index.

In the second search as 17>11 middle index value is 19 and that is the second value taken for middle index.

In the third search as 17<19 middle index value is 12 and that is the third value taken for middle index.

In the forth search as 17>12 middle index is 17 and that is the forth value taken for middle index also 17 is the search vale so true will be returned.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote