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

Question 14 Suppose that L is a sorted list of length 1000. To determine whether

ID: 3829736 • Letter: Q

Question

Question 14

Suppose that L is a sorted list of length 1000. To determine whether an item is in L, the maximum number of comparisons executed by the binary search algorithm, as discussed in this book, is ____.

1

42

500

None of these

1 points   

Question 15

Consider the following list.

list = {20, 10, 17, 2, 18, 35, 30, 90, 48, 47};

Suppose that sequential search as discussed in the book is used to determine whether 2 is in list. Exactly how many key comparisons are executed by the sequential search algorithm?

3

4

5

8

1 points   

Question 16

Consider the following list.

list = {24, 20, 10, 75, 70, 18, 60, 35}

Suppose that list is sorted using the selection sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase; that is, after two iterations of the outer for loop?

list = {10, 18, 24, 20, 75, 70, 60, 35}

list = {10, 18, 20, 24, 75, 70, 60, 35}

list = {10, 18, 24, 75, 70, 20, 60, 35}

list = {10, 20, 24, 75, 70, 20, 60, 35}

1 points   

Question 17

Consider the following list.

list = {5, 11, 25, 28, 45, 78, 100, 120, 125};

Suppose that binary search as discussed in the book is used to determine whether 110 is in list. What are the values of first and last when the while loop, in the body of the binarySearch method, terminates?

first = 6, last = 6

first = 6, last = 7

first = 7, last = 6

None of these

1 points   

Question 18

Which technique does a binary search use to find an element in a list?

divide and conquer

row and column

first to last

hunt and peck

1 points   

Question 19

1

3

5

6

1 points   

Question 20

Because the list is too big

Because the list is not sorted

Because it is a list of integers

A binary search can be used on the list

1

42

500

None of these

Explanation / Answer

14) Maximum number of comparison will be log n i.e log 1000 base 2 that comes as 10 .
So NONE OF THESE

15) For number 2 , it will search from begenning so maximum 4 comparison

16)
list = {10, 18, 24, 75, 70, 20, 60, 35} because 10 and 18 will come to its correct postion and inplace of 10 24 will go and in place of 18 , 20 will go

17) first = 7, last = 6

because we will come to state where first = 7, last = 7 then high will reduced by 1

18) divide and conquer

19) Image not loading

20) Image not loading , but from the option I can say that if the list is not sortred we can apply BS and if list is sorted we can use the list

Thanks, let me know if there is any concern.

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