Exam 18: Searching and Sorting Algorithms

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

During the sorting phase of insertion sort, the array containing the list is divided into two sublists, sorted and unsorted.

(True/False)
4.8/5
(36)

Assuming the following list declaration, which element is at the position 0 after the first iteration of selection sort? int list[] = {16, 30, 24, 7, 62, 45, 5, 55}

(Multiple Choice)
4.8/5
(32)

In a binary search, first, the search item is compared with the last element of the list.

(True/False)
4.8/5
(38)

The first step in the quick sort partition algorithm is to determine the ____________________ and swap it with the first element in the list.

(Short Answer)
4.8/5
(33)

In the bubble sort algorithm, the following code accomplishes swapping values in elements at positions index and index + 1.

(Multiple Choice)
4.9/5
(37)

In a quick sort, all of the sorting work is done by the function ____________________.

(Short Answer)
4.8/5
(39)

Consider the following list:int list[] = {4, 8, 19, 25, 34, 39, 45, 48, 66, 75, 89, 95} When performing a binary search, the target is first compared with ____.

(Multiple Choice)
4.9/5
(45)

A sequential search of an n-element list takes ____ key comparisons if the item is not in the list.

(Multiple Choice)
4.8/5
(37)

____ sort requires knowing where the middle element of the list is.

(Multiple Choice)
4.7/5
(35)

With the binary search algorithm, ____ key comparison(s) is/are made in the successful case-the last time through the loop.

(Multiple Choice)
4.8/5
(29)

The ____________________ search algorithm is the optimal worst-case algorithm for solving search problems by using the comparison method.

(Short Answer)
4.9/5
(30)

The selection sort algorithm finds the location of the smallest element in the unsorted portion of the list.

(True/False)
4.9/5
(45)

A sequential search of an n-element list takes ____ key comparisons on average to determine whether the search item is in the list.

(Multiple Choice)
4.8/5
(36)

Consider the following list:int list[] = {4, 8, 19, 25, 34, 39, 45, 48, 66, 75, 89, 95} When performing a binary search for 75, after the first comparison, the search is restricted to ____.

(Multiple Choice)
4.8/5
(32)

The top node of a comparison tree is call the ____________________ node.

(Short Answer)
4.8/5
(34)

The sequential search algorithm uses a(n) ____ variable to track whether the item is found.

(Multiple Choice)
4.8/5
(39)

If n = 1000, then to sort the list, selection sort makes about 50,000 key comparisons.

(True/False)
4.9/5
(41)

Suppose that L is a sorted list of size 1024, and we want to determine whether an item x is in L.From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.

(True/False)
4.8/5
(39)

The behavior of quick sort is ____ in the worst case and ____ in the average case.

(Multiple Choice)
4.9/5
(43)

With insertion sort, the variable firstOutOfOrder is initialized to ____, assuming n is the length of the list.

(Multiple Choice)
4.7/5
(29)
Showing 21 - 40 of 40
close modal

Filters

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