Services
Discover
Homeschooling
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 Late Objects
Quiz 14: Sorting and Searching
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 61
Multiple Choice
A portion of your program includes the loop shown in the code snippet below to examine the elements of an array arr: Int count = 0; Int targetVal = 70; For (int i = 0; i < arr.length; i++) { If (arr[i] >= targetVal) { Count++; } } What can you conclude about the running time of this section of code?
Question 62
Multiple Choice
If an element is present in an array of length n, how many element visits, on average, are necessary to find it using a linear search?
Question 63
Multiple Choice
Binary search is an ____ algorithm.
Question 64
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 65
Multiple Choice
Which of the following statements about running times of algorithms is correct?
Question 66
Multiple Choice
Given an ordered array with 31 elements, how many elements must be visited in the worst case of binary search?
Question 67
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 68
Multiple Choice
If you implement a recursive linear search, its performance will be ____.
Question 69
Multiple Choice
An algorithm that tests whether the first array element is equal to any of the other array elements would be an ____ algorithm.
Question 70
Multiple Choice
Can you search the following array using binary search? Int[] A = {6, 5, 4, 2, 0, 1, -1, -17};
Question 71
Multiple Choice
An algorithm that cuts the work in half in each step is an ____ algorithm.
Question 72
Multiple Choice
A binary search is generally ____ a linear search.
Question 73
Multiple Choice
Another name for linear search is ____ search.
Question 74
Multiple Choice
A search technique where, in each step, you split the size of the search in half is called a____ search.
Question 75
Multiple Choice
A portion of your program includes the loops shown in the code snippet below to examine the elements of two arrays, arr1 and arr2, both of length n: Int matches = 0; For (int i = 0; i < arr1.length; i++) { For (int j = 0; j < arr2.length; j++) { If (arr1[i].equals(arr2[j]) ) { Matches++; } } } What can you conclude about the running time of this section of code?
Question 76
Multiple Choice
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?