What is the worst-case time complexity for a search operation in a Hash Table (assuming all keys collide)?
Category: Uncategorized
Consider the following snippet from an UnsortedListPQ implem…
Consider the following snippet from an UnsortedListPQ implementation. What is its time complexity? int minIndex = 0; for (int i=1; i < data.size(); i++) { if (data.get(i).compareTo(data.get(minIndex)) < 0) { minIndex = i; } } return data.remove(minIndex);
Which of the following best defines the Heap-Order Property…
Which of the following best defines the Heap-Order Property for a Min-Heap?
According to the lecture slides, what is the time complexity…
According to the lecture slides, what is the time complexity of removeMin for the Sorted List implementation (assuming efficient removal from the front)?
The “Combine” phase (or “merge” step) of Merge-Sort, which c…
The “Combine” phase (or “merge” step) of Merge-Sort, which combines two already sorted lists (S1 and S2) into one final sorted list (S), runs in ______ time. (Use Big-O notation, e.g., O(n)).
What does the following upheap condition check for? while (…
What does the following upheap condition check for? while (j > 0) { int parent = (j – 1) / 2; if (heap.get(j).compareTo(heap.get(parent)) >= 0) break; // swap logic… }
Which of the following sorting algorithms have an average-ca…
Which of the following sorting algorithms have an average-case time complexity of O(n log n)? (Select all that apply)
The Java implementation of Bubble Sort shown in the material…
The Java implementation of Bubble Sort shown in the materials includes a `boolean swapped` flag. What is the purpose of this optimization?
Black-and-yellow stripes are a common warning coloration. Am…
Black-and-yellow stripes are a common warning coloration. Among a set of insects that possess black-and-yellow patterns are:-female wasps that sting-male wasps that do not sting-a tasty, harmless, and nutritious leaf beetle-an acrid blister beetle that makes you sick if you eat it-a harmless hover fly that sounds and looks like a beeThis assortment represents
Algorithms like Counting Sort and Radix Sort are non-compari…
Algorithms like Counting Sort and Radix Sort are non-comparison sorts. By using assumptions about the data (e.g., keys being integers in a known range), they can achieve a faster time complexity, beating the theoretical ______ limit of comparison-based sorts.