Services
Discover
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
C++ Programming Study Set 1
Exam 18: Searching and Sorting Algorithms
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
True/False
During the sorting phase of insertion sort, the array containing the list is divided into two sublists, sorted and unsorted.
Question 22
Multiple Choice
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}
Question 23
True/False
In a binary search, first, the search item is compared with the last element of the list.
Question 24
Short Answer
The first step in the quick sort partition algorithm is to determine the ____________________ and swap it with the first element in the list.
Question 25
Multiple Choice
In the bubble sort algorithm, the following code accomplishes swapping values in elements at positions index and index + 1.
Question 26
Short Answer
In a quick sort, all of the sorting work is done by the function ____________________.
Question 27
Multiple Choice
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 ____.
Question 28
Multiple Choice
A sequential search of an n-element list takes ____ key comparisons if the item is not in the list.
Question 29
Multiple Choice
____ sort requires knowing where the middle element of the list is.
Question 30
Multiple Choice
With the binary search algorithm, ____ key comparison(s) is/are made in the successful case-the last time through the loop.
Question 31
Short Answer
The ____________________ search algorithm is the optimal worst-case algorithm for solving search problems by using the comparison method.
Question 32
True/False
The selection sort algorithm finds the location of the smallest element in the unsorted portion of the list.
Question 33
Multiple Choice
A sequential search of an n-element list takes ____ key comparisons on average to determine whether the search item is in the list.
Question 34
Multiple Choice
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 ____.
Question 35
Short Answer
The top node of a comparison tree is call the ____________________ node.
Question 36
Multiple Choice
The sequential search algorithm uses a(n) ____ variable to track whether the item is found.
Question 37
True/False
If n = 1000, then to sort the list, selection sort makes about 50,000 key comparisons.
Question 38
True/False
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.