Exam 14: Sorting and Searching
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
Find the simplest order of growth of the following expression: n3 + log(n5).
(Multiple Choice)
4.8/5
(38)
The partial binary search method below is designed to search an array of String objects sorted in ascending order. Select the expression that would be needed to complete the method. public static int search(String[] a, int low, int high, String item)
{
If (low <= high)
{
Int mid = (low + high) / 2;
Int result = ____________________________;
If (result == 0)
{
Return mid;
}
Else if (result < 0)
{
Return search(a, mid + 1, high, item);
}
Else
{
Return search(a, low, mid - 1, item);
}
}
Return -1;
}
(Multiple Choice)
4.9/5
(30)
Suppose you wanted to test your sort on an array filled with different elements each time the code is run. What is an efficient technique for creating an array of 1,000 elements for each run?
(Multiple Choice)
4.8/5
(35)
The method checkArray examines an array arr: public static boolean checkArray(int[] arr)
{
If (arr[0] >= arr[arr.length -1])
{
Return true;
}
Return false;
}
What can you conclude about the running time of this section of code?
(Multiple Choice)
4.7/5
(34)
If you want to use the Comparable interface, you must implement a single method called ____.
(Multiple Choice)
4.9/5
(40)
How large does n need to be so 0.3n2 is greater than 2.5n - 3?
(Multiple Choice)
4.8/5
(40)
The merge sort algorithm presented in section 14.4, which sorts an array of integers in ascending order, uses the merge method which is partially shown below. Select the condition that would be needed to complete the method so that the elements are sorted in descending order. private static void merge(int[] first, int[] second, int[] A) {
Int iFirst = 0;
Int iSecond = 0;
Int j = 0;
While (iFirst < first.length && iSecond < second.length)
{
If (_____________________________)
{
A[j] = first[iFirst];
IFirst++;
}
Else
{
A[j] = second[iSecond];
ISecond++;
}
J++;
}
// rest of the method follows here
}
(Multiple Choice)
4.9/5
(36)
When the size of an array increases by a factor of 100, the time required by selection sort increases by a factor of ____.
(Multiple Choice)
4.7/5
(37)
Assume we are using quicksort to sort an array in ascending order. What can we conclude about the elements to the left of the currently placed pivot element?
(Multiple Choice)
4.8/5
(34)
Showing 101 - 109 of 109
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)