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
Java Programming
Exam 14: Searching and Sorting
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 1
True/False
In insertion sort, during the sorting phase the array containing the list is divided into three sublists.
Question 2
True/False
Selection sort swaps the smallest element in the unsorted portion of the list to a new position.
Question 3
True/False
In selection sort, initially, the entire list, that is, list[0]...list[listLength], is the unsorted list.
Question 4
Multiple Choice
-If the list in the accompanying figure was to be searched using a sequential search on an unordered list, how many key comparisons would be made to find the number 44?
Question 5
Multiple Choice
If the list in the accompanying figure was sorted, what would be the middle element?
Question 6
Multiple Choice
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 28 is in list. What are the values of first and last when the while loop in the body of the binarySearch method terminates?
Question 7
True/False
On average, the number of comparisons made by a sequential search is equal to one-third the size of the list.
Question 8
Multiple Choice
-If the list in the accompanying figure was to be searched for the number 44 using a binary search, how many key comparisons would have to be made?
Question 9
Multiple Choice
-Based on the accompanying figure, in a sequential search, what is the minimum number of comparisons that have to be made if the search item was 10?
Question 10
True/False
In a sequential search, you search an array starting from the middle component.
Question 11
True/False
In the binary search algorithm, two key comparisons are made through every iteration of the loop.
Question 12
Multiple Choice
-What is the minimum number of comparisons that have to be made to find 18 using a sequential search on the list shown in the accompanying figure?
Question 13
Multiple Choice
What is the maximum number of key comparisons made when searching a list L of length n for an item using a binary search?
Question 14
Multiple Choice
Suppose that L is a sorted list of length 1000. To determine whether an item is in L, the maximum number of comparisons executed by the binary search algorithm, as discussed in this book, is ____.
Question 15
Multiple Choice
-If a binary search was used on the list in the accompanying figure, which element would the search element be compared to first?
Question 16
Multiple Choice
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 110 is in list. Exactly how many key comparisons are executed by binary search?