The average-time complexity for heap sort is ________. Question 8 options: O(n*n) O(logn) O(1) O(nlogn) O(n)
Added by Marcos W.
Step 1
Let's think step by step. Show more…
Show all steps
Your feedback will help us improve your experience
Madhur L and 98 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
The following are examples of computing times in algorithm analysis. To make the difference clearer, let's compare based on the execution time where n = 1,000,000 and time = 1 millisecond: Big-Oh Description Algorithm Running Time Sample Code Implementation O(1) Constant return n (n+1)/2 O(log2 n) Logarithmic Binary Search 19.93 microseconds while n > 1 count < count + 1 n = n / 2 O(n) Linear Sequential 1.00 seconds for i = 1 to n search sum < sum + i O(n log2 n) Heapsort 19.93 seconds O(n^2) Quadratic Insertion Sort 11.57 days for i = 1 to n for j = 1 to n sum = sum + i O(n^3) Cubic Floyd's Algorithm O(2^n) Exponential 317.10 centuries O(n^n) Eternity O(log2 log2 n) Operations on the O-Notation: Rule for Sums Suppose that T(n) = O(f(n)) and Tz(n) = O(g(n)): Then, t(n) = Ti(n) + Tz(n) = O(max(f(n), g(n))).
Madhur L.
4. (10%) Fill Big-O notations in the following table for the comparison of different Priority Queue implementations. Priority Queue Implementation Enqueue Dequeue Heap Binary Search Tree Balanced Skewed Unsorted List Sorted List 5. (10%) Select your answer from A, B, C, D, E, F, and G for each blank in the following statements. A. selectionSort B. bubbleSort C. shortBubble D. insertionSort E. mergeSort F. quickSort G. heapSort (1) ______'s Big-O complexity is O(N) for Best case. (2) ______ recognize(s) if the values are already sorted. (3) ______ is (are) inherently unstable. (4) ______'s Big-O complexity is always O(N^2) for Best case, Average case, and Worst case. (5) ______'s Big-O complexity is always O(log2N) for Best case, Average case, and Worst case.
Akash M.
Suppose we have a collection of algorithm that runs on O(1), O(n), O(n^2), O(n log n), and O(2^n). Which of the following list them from fastest to slowest? a) O(1), O(n log n), O(n), O(n^2), O(2^n) b) O(1), O(n), O(n log n), O(n^2), O(2^n) c) O(1), O(n), O(n^2), O(n log n), O(2^n) d) None of the above
Adi S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD