Exam 18: Searching and Sorting Algorithms

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

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.7/5
(77)

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.7/5
(63)

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

(Multiple Choice)
4.9/5
(82)

Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers   and   We say that   is of g(n). written   if there exist positive constants c and   such that   For all   and Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers   and   We say that   is of g(n). written   if there exist positive constants c and   such that   For all   We say that Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers   and   We say that   is of g(n). written   if there exist positive constants c and   such that   For all   is of g(n). written Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers   and   We say that   is of g(n). written   if there exist positive constants c and   such that   For all   if there exist positive constants c and Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers   and   We say that   is of g(n). written   if there exist positive constants c and   such that   For all   such that Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers   and   We say that   is of g(n). written   if there exist positive constants c and   such that   For all   For all Let f and g be real-valued functions. Assume that f and g are nonnegative, that is, for all real numbers   and   We say that   is of g(n). written   if there exist positive constants c and   such that   For all

(Short Answer)
4.8/5
(72)

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.9/5
(73)

If a list of eight elements is sorted using selection sort,the unsorted list is ____ after the second iteration.

(Multiple Choice)
4.8/5
(82)

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

(Multiple Choice)
4.8/5
(73)

The quick sort algorithm uses the ____________________ technique to sort a list.

(Short Answer)
4.9/5
(99)

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

(Short Answer)
4.8/5
(79)

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

(Multiple Choice)
4.8/5
(76)

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

(Short Answer)
4.8/5
(91)

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

(Multiple Choice)
4.9/5
(97)

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

(Short Answer)
4.9/5
(84)

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

(Multiple Choice)
4.8/5
(72)

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

(Multiple Choice)
4.9/5
(73)

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

(True/False)
4.9/5
(88)

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

(Multiple Choice)
4.9/5
(92)

Which of the following correctly states the quick sort algorithm?

(Multiple Choice)
4.8/5
(62)

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)
5.0/5
(80)

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.9/5
(82)
Showing 21 - 40 of 50
close modal

Filters

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