Exam 18: Searching and Sorting Algorithms

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

For a list of length n, the bubble sort makes exactly ____________________ key comparisons.

Free
(Short Answer)
4.8/5
(40)
Correct Answer:
Verified

n(n-1)/2

When working with the unsorted portion of a list, the second step in a selection sort is to ____.

Free
(Multiple Choice)
4.8/5
(28)
Correct Answer:
Verified

C

Assume that list consists of the following elements.What is the result after bubble sort completes? int list[] = {2, 56, 34, 25, 73, 46, 89, 10, 5, 16};

Free
(Multiple Choice)
4.8/5
(25)
Correct Answer:
Verified

C

A sequence of branches in a comparison tree is called a(n) ____________________.

(Short Answer)
4.7/5
(41)

The sequential search algorithm does not require that the list be sorted.

(True/False)
4.8/5
(43)

If n = 1000, to sort the list, bubble sort makes about ____ item assignments.

(Multiple Choice)
4.9/5
(37)

A comparison tree is a(n) ____________________ tree.

(Short Answer)
4.7/5
(38)

To construct a search algorithm of the order less than log2n, it cannot be ____________________ based.

(Short Answer)
4.8/5
(38)

In the average case, sequential search typically searches ____.

(Multiple Choice)
4.9/5
(37)

For a list of length n, selection sort makes ____ item assignments.

(Multiple Choice)
4.7/5
(33)

For a list of length n, insertion sort makes ____ key comparisons, in the worst case.

(Multiple Choice)
4.8/5
(40)

When moving array values for insertion sort, to move list[4] into list[2], first ____.

(Multiple Choice)
4.8/5
(32)

Let f be a function of n.By the term ____________________, we mean the study of the function f as n becomes larger and larger without bound.

(Short Answer)
4.9/5
(35)

We can trace the execution of a comparison-based algorithm by using a graph called a ____.

(Multiple Choice)
4.8/5
(32)

The formula to find the index of the middle element of a list is ____.

(Multiple Choice)
4.7/5
(39)

The swap function of quick sort is written differently from the swap function for selection sort.

(True/False)
4.9/5
(42)

The binary search algorithm can be written iteratively or recursively.

(True/False)
5.0/5
(39)

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

(Multiple Choice)
4.7/5
(34)

In a bubble sort for list of length n, the first step is to compare elements ____.

(Multiple Choice)
4.9/5
(40)

In a bubble sort, the smaller elements move toward the bottom, and the larger elements move toward the top of the list.

(True/False)
4.9/5
(36)
Showing 1 - 20 of 40
close modal

Filters

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