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
Big Java Binder Early Objects
Exam 14: Sorting and Searching
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 81
Multiple Choice
Which sort algorithm is used in the sort method in the Java Arrays class when the array length is less than 7?
Question 82
Multiple Choice
Assume we are using quicksort to sort an array in ascending order. What can we conclude about the indexes of two pivot elements placed in consecutive recursive calls?
Question 83
Multiple Choice
A portion of your program implements a loop in which each step contains a fixed number of actions. What can you conclude about the running time of this section of code?
Question 84
Multiple Choice
Which function has a faster growth rate: θ(n
1/2
) or θ(log(n) ) ?
Question 85
Multiple Choice
Merge sort has a O(n log
2
(n) ) complexity. If a computer can sort 1,024 elements in an amount of time x, approximately how much longer will it take the computer to sort 1,024 times that many, or 1,048,576 elements?
Question 86
Multiple Choice
The code segment below displays a pattern of asterisks. Select an expression to complete the code segment so that the resulting algorithm has O(n) running time. for (int k = 0; k < n; k++) { For _______________________ { System.out.print("*") ; } System.out.println() ; }
Question 87
Multiple Choice
Consider the following code snippet: public static void sort(int[]A) insertion sort
Question 88
Multiple Choice
If the Arrays static method binarySearch is called on an array of 10 elements and returns a value of 10, what can be concluded? I the element is not found II that value cannot be returned from method binarySearch III if added, the element would be the largest element in the array
Question 89
Multiple Choice
The sort method of the Arrays class sorts arrays containing objects of classes that implement the ____ interface.
Question 90
Multiple Choice
In the worst case, a linear search locates a value in an array of length n in ____ steps.
Question 91
Multiple Choice
After 9 iterations of selection sort working on an array of 10 elements, what must hold true?
Question 92
Multiple Choice
The analysis for the number of visits in a binary search begins with the equation, T(n) = T(n / 2) + 1. What does the number 1 represent in this equation?
Question 93
Multiple Choice
Suppose you have a phone number and need to find the address that it corresponds to. If there are 2,000,000 entries, how many do you expect to search in a printed phone directory before finding the address you are looking for?