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
Starting Out with C++
Exam 8: Searching and Sorting Arrays
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 1
True/False
Before you can perform a selection sort, the data must be stored in ascending order.
Question 2
Multiple Choice
The following is the pseudocode for which type of algorithm? Set first to 0 Set last to the last subscript in the array Set found to False Set position to -1 While found is not true and first is less than or equal to last Set middle to the subscript halfway between array[first] and array[last] If array[middle] equals the desired value Set found to true Set position to middle Else If array[middle] is greater than the desired value Set last to middle - 1 Else Set first to middle + 1 End If End While Return position
Question 3
Multiple Choice
Array elements must __________ before a binary search can be performed.
Question 4
True/False
The number of comparisons made by a binary search is expressed in powers of two.
Question 5
True/False
On average, an item is just as likely to be found near the beginning of an array as near the end.
Question 6
Multiple Choice
The __________ sort usually performs fewer exchanges than the __________ sort.
Question 7
Multiple Choice
A __________ algorithm is a method of locating a specific item of information in a larger collection of data.
Question 8
Multiple Choice
The advantage of a linear search is its
Question 9
Multiple Choice
Assume you have two integer variables, num1 and num2. Which of the following is the correct way to swap the values in these two variables?
Question 10
Multiple Choice
When an array is sorted from highest to lowest, it is said to be in
Question 11
True/False
Before you can perform a bubble sort, the data must be stored in descending order.
Question 12
Multiple Choice
A(n) __________ search uses a loop to sequentially step through an array.
Question 13
Multiple Choice
A __________ search is more efficient than a __________ search.
Question 14
Multiple Choice
The following function should swap the values contained in two integer variables, num1 and num2. What, if anything, is wrong with this function? Void swap(int num1, int num2) { Int temp = num2; Num2 = num1; Num1 = temp; }