COSC 2436 Exam 2 Final review
The Ultimate Student Q&A Bundle – Study Smarter, Not Harder"
A sorting algorithm that does not change the relative order of objects that are equal is called -
stable
The quick sort algorithm uses a ________ to divide the array into two pieces. - pivot
Which sorting algorithm divides the array into two pieces based on the selection of a pivot
element? - quick sort
Which statements are true about the pivot element in quick sort? - all of the above
In quick sort, dividing the array portions before and after the pivot are called - partitions
In quick sort, the partition step takes at most ______ comparisons for n items. - n
The ideal situation in quick sort is when the pivot moves - to the center of the array
In quick sort, having every partition form sub array of roughly the same size - is optimal
The best-case performance of quick sort for n items is - O(n log n)
The average-case performance of quick sort for n items is - O(n log n)
The worst-case time efficiency of a sequential search on an array is - O(n)
When searching an unsorted array of items, the recursive search performs ______ comparisons
the iterative search. - the same number of comparisons as
A sequential search of a sorted array can tell whether an item is present in the array in _____ a
sequential search of an unsorted array. - fewer comparisons than
A search on a data set that divides the data roughly in half every iteration is called a(n) _____
search - binary
In an array of 100 items sorted in ascending order, if you are searching for the number 165 and
the entry at array index [50] has a value of 72, what can we conclude? - all of the above
What is the base case in the recursive algorithm for a binary search of a sorted array? - first
index > last
Given the following array, how many comparisons to an array entry are performed to search for
the number 13 if you use the binary search algorithm?
, 2 3 5 7 11 13 17 19 23 29 31 37 - 1
Given the following array, how many comparisons to an array entry are performed to search for
the number 2 if you use the binary search algorithm?
2 3 5 7 11 13 17 19 23 29 31 37 - 5
Given the following array, how many comparisons to an array entry are performed to search for
the number 37 if you use the binary search algorithm?
2 3 5 7 11 13 17 19 23 29 31 37 - 7
Given the following array, how many comparisons to an array entry are performed to search for
the number 11 if you use the binary search algorithm?
2 3 5 7 11 13 17 19 23 29 31 37 - 7
What ADT dictionary method creates an iterator that traverses all the values in the dictionary? -
getValueIterator
In the ADT (Abstract Data Type) dictionary, a key-null pair - is not stored
In the ADT (Abstract Data Type) dictionary, you can traverse - all of the above
If you create a keyIterator and a valueIterator for the same dictionary, the keyIterator is _____
the valueIterator. - the same length as
A sorted dictionary must use search keys that belong to a class that implements the interface -
Comparable
The class Scanner can break a string into substrings called - tokens
The class Scanner can break a string into substrings that are separated by - delimiters
Which method in the class Scanner extracts the tokens from any string? - next
In an ADT dictionary that implements DictionaryInterface, what is returned by the getValue
method if the associated search key is not found? - it return null
A(n) _____ provides the line numbers in a document for each occurrence of a given word. -
concordance
To remove an entry from an unsorted array-based dictionary, locate the entry and - replace
it with the last entry in the dictionary
The Ultimate Student Q&A Bundle – Study Smarter, Not Harder"
A sorting algorithm that does not change the relative order of objects that are equal is called -
stable
The quick sort algorithm uses a ________ to divide the array into two pieces. - pivot
Which sorting algorithm divides the array into two pieces based on the selection of a pivot
element? - quick sort
Which statements are true about the pivot element in quick sort? - all of the above
In quick sort, dividing the array portions before and after the pivot are called - partitions
In quick sort, the partition step takes at most ______ comparisons for n items. - n
The ideal situation in quick sort is when the pivot moves - to the center of the array
In quick sort, having every partition form sub array of roughly the same size - is optimal
The best-case performance of quick sort for n items is - O(n log n)
The average-case performance of quick sort for n items is - O(n log n)
The worst-case time efficiency of a sequential search on an array is - O(n)
When searching an unsorted array of items, the recursive search performs ______ comparisons
the iterative search. - the same number of comparisons as
A sequential search of a sorted array can tell whether an item is present in the array in _____ a
sequential search of an unsorted array. - fewer comparisons than
A search on a data set that divides the data roughly in half every iteration is called a(n) _____
search - binary
In an array of 100 items sorted in ascending order, if you are searching for the number 165 and
the entry at array index [50] has a value of 72, what can we conclude? - all of the above
What is the base case in the recursive algorithm for a binary search of a sorted array? - first
index > last
Given the following array, how many comparisons to an array entry are performed to search for
the number 13 if you use the binary search algorithm?
, 2 3 5 7 11 13 17 19 23 29 31 37 - 1
Given the following array, how many comparisons to an array entry are performed to search for
the number 2 if you use the binary search algorithm?
2 3 5 7 11 13 17 19 23 29 31 37 - 5
Given the following array, how many comparisons to an array entry are performed to search for
the number 37 if you use the binary search algorithm?
2 3 5 7 11 13 17 19 23 29 31 37 - 7
Given the following array, how many comparisons to an array entry are performed to search for
the number 11 if you use the binary search algorithm?
2 3 5 7 11 13 17 19 23 29 31 37 - 7
What ADT dictionary method creates an iterator that traverses all the values in the dictionary? -
getValueIterator
In the ADT (Abstract Data Type) dictionary, a key-null pair - is not stored
In the ADT (Abstract Data Type) dictionary, you can traverse - all of the above
If you create a keyIterator and a valueIterator for the same dictionary, the keyIterator is _____
the valueIterator. - the same length as
A sorted dictionary must use search keys that belong to a class that implements the interface -
Comparable
The class Scanner can break a string into substrings called - tokens
The class Scanner can break a string into substrings that are separated by - delimiters
Which method in the class Scanner extracts the tokens from any string? - next
In an ADT dictionary that implements DictionaryInterface, what is returned by the getValue
method if the associated search key is not found? - it return null
A(n) _____ provides the line numbers in a document for each occurrence of a given word. -
concordance
To remove an entry from an unsorted array-based dictionary, locate the entry and - replace
it with the last entry in the dictionary