Question
1. An array of integers is to be sorted from largest to smallest using a selection sort. Assume the array originally contains the following elements:
1. An array of integers is to be sorted from largest to smallest using a selection sort. Assume the array originally contains the following elements: 2 6 17 23 10 14 What will it look like after the third pass through the loop?
A)23 6 10 17 2 14
B)23 17 10 6 2 14
C)23 17 10 14 6 2
D)23 17 14 2 10 6
E)23 17 14 10 2 6
2. What is required to implement a binary search?
A)Hash table
B)Pivot value
C)Recursive method
D)Sorted data
E)None of the above is required.
3. What is the minimum number of locations a sequential search algorithm will have to examine when looking for a particular value in an array of 100 elements?
A)1
B)6
C)7
D)8
E)100
4. What is the minimum number of locations a binary search algorithm will have to examine when looking for a particular value in a sorted array of 200 elements?
A)1
B)6
C)7
D)8
E)200
5. Which sorting algorithm is LEAST efficient when performed on an array in which the values are already in the desired sorted order?
A)Binary sort
B)Insertion sort
C)Merge sort
D)Selection sort
E)It is not possible to know which will be slowest.
6. An array of integers is to be sorted from smallest to largest using an insertion sort. Assume the array originally contains the following elements: 30 8 17 11 20 25 What will it look like after the third pass through the loop?
A)11 17 30 8 20 25
B)11 17 30 8 25 20
C)8 11 17 20 25 30
D)8 11 17 20 30 25
E)8 11 17 30 20 25
7. What is the maximum number of locations a sequential search algorithm will have to examine when looking for a particular value in an array of 50 elements?
A)50
B)25
C)12
D)6
E)1
8. In general, which of the following sorting algorithms is the LEAST efficient?
A)Bubble sort
B)Insertion sort
C)Heap sort
D)Merge sort
E)Selection sort
9. Which of the following sorting algorithms is described by this text? "Take the item at index 1 and see if it is in order compared to the item at index 0. If it is not, then swap the two items. Next take the item at index 2 and compare it to the items at the lower indexes. Move items in the lower indexes to a higher one until you find the proper location to place the value so that it is in the correct order. Continue this process with all remaining indexes."
A)Insertion sort
B)Heap sort
C)Merge sort
D)Quick sort
E)Selection sort
10. Which of the following are quadratic-sorting algorithms?
- insertion sort
- selection sort
- merge sort
A)I only
B)II only
C)III only
D)I and II only
E)I, II, and III
11. What is the maximum number of locations that a binary search algorithm would have to examine when looking for a particular value in a sorted array of 50 elements?
A)1
B)6
C)7
D)8
E)100
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started