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

Question 1 1 3 5 7 1 points Question 2 7 16 24 45 1 points Question 3 1 3 5 6 1

ID: 3829697 • Letter: Q

Question

Question 1

1

3

5

7

1 points   

Question 2

7

16

24

45

1 points   

Question 3

1

3

5

6

1 points   

Question 4

0

1

7

8

1 points   

Question 5

To design a general-purpose sort method, sortList, to sort a list, which of the following must be parameters of the method sortList.

(i) The array containing the list
(ii) The length of the list
(iii) A boolean variable indicating whether the sort was successful

(i)

(ii)

(i) and (ii)

(i), (ii), and (iii)

1 points   

Question 6

5 and 16

65 and 16

5 and 45

7 and 30

1 points   

Question 7

1

2

3

4

1 points   

Question 8

2

5

6

8

1 points   

Question 9

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. Exactly how many key comparisons are executed by binary search?

3

5

8

12

1 points   

Question 10

1

2

3

4

1 points   

Question 11

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 95 is in list. Exactly how many key comparisons are executed by the sequential search algorithm?

1

8

9

10

1 points   

Question 12

Consider the following list.

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

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

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

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

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

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

1 points   

Question 13

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 28 is in list. What are the values of first and last when the while loop in the body of the binarySearch method terminates?

first = 3, last = 3

first = 0, last = 3

first = 2, last = 4

None of these

1 points   

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

3

5

7

Explanation / Answer

Most of the images are not visible, asnwered questions where images are not required.

Answer in bold

Question 5

To design a general-purpose sort method, sortList, to sort a list, which of the following must be parameters of the method sortList.

(i) The array containing the list
(ii) The length of the list
(iii) A boolean variable indicating whether the sort was successful

(i)

(ii)

(i) and (ii)

(i), (ii), and (iii)

Question 9

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. Exactly how many key comparisons are executed by binary search?

3

5

8

12

Question 11

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 95 is in list. Exactly how many key comparisons are executed by the sequential search algorithm?

1

8

9

10

1 points   

Question 12

Consider the following list.

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

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

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

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

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

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

(i)

(ii)

(i) and (ii)

(i), (ii), and (iii)

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