Exam 14: Applications of Arrays Searching and Sorting and Strings

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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?

(Multiple Choice)
4.8/5
(42)

If a binary search was used on the list in the accompanying figure, which element would the search element be compared to first?

(Multiple Choice)
4.9/5
(37)

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 ____.

(Multiple Choice)
4.9/5
(35)

In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 24?

(Multiple Choice)
4.9/5
(32)

In general, if L is a sorted list of size n, to determine whether an element is in L, the binary search makes at most 2 * log2n + 2 key (item) comparisons.

(True/False)
4.9/5
(42)

In a sequential search, the array must be sorted.

(True/False)
4.8/5
(34)

If the list in the accompanying figure was sorted using selection sort, which two elements would be swapped first?

(Multiple Choice)
4.9/5
(33)

On average, the number of comparisons made by a sequential search is equal to one-third the size of the list.

(True/False)
4.8/5
(36)

If the list in the accompanying figure were to be searched using a sequential search on an ordered list, how many key comparisons would be made to find the number 44?

(Multiple Choice)
4.9/5
(43)

A binary search starts by comparing the search item to the first item in the list.

(True/False)
4.8/5
(26)

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?

(Multiple Choice)
4.8/5
(35)

Suppose that L is a list of length 100. In a successful search, to determine whether an item is in L, on average the number of key comparisons executed by the sequential search algorithm, as discussed in this book, is ____.

(Multiple Choice)
4.7/5
(48)

Insertion sort makes approximately the same number of key comparisons as item assignments.

(True/False)
4.9/5
(30)

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?

(Multiple Choice)
4.9/5
(38)

Key comparisons are also called item comparisons.

(True/False)
4.8/5
(38)

The selection sort algorithm repeatedly moves the smallest element from the unsorted list to the top of the unsorted list.

(True/False)
4.7/5
(38)

Selection sort swaps the smallest element in the unsorted portion of the list to a new position.

(True/False)
4.8/5
(31)

To determine whether a given item is in an ordered list of length 1024, binary search makes at most 22 key comparisons.

(True/False)
4.8/5
(37)

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

(Multiple Choice)
4.8/5
(29)

What is the maximum number of key comparisons made when searching a list L of length n for an item using a binary search?

(Multiple Choice)
4.8/5
(37)
Showing 21 - 40 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)