Big-O Asymptotic for Search and Sort algorithms

¡Supera tus tareas y exámenes ahora con Quizwiz!

The amortized cost of the insertion of an item into a dynamic array is constant when the resize function is implemented using.

Doubling memory strategy

A quadratic algorithm, O(n2), takes 103 sec to complete a task on the input size of 106 elements. What should the input size be for this algorithm to complete the same task in 4 · 103 sec?

2 * 10^6

What is the size of the auxiliary array for the counting sort on the input: 5, 2, 4, 2, 0, 2, 5?

6

Can you apply the lower bound theorem to the counting sort algorithm?

False

The binary and linear search algorithms take the same number of comparisons to find the target in the worst case.

False

What is the complexity of the Binary Search algorithm that runs on sorted input? Assume that n is the input size.

O(log2(n))

Select the most efficient sorting algorithm to sort 106 records based on the SSN (social security number) filter.

Radix Sort

The first algorithm performs 10−8n2 operations on an input of the size n and the second algorithm on the same input performs 103n operations. Mark the correct answer for the statement below: "There exists an input such that the first and second algorithm performs the same number of operations."

True

Big-O: Heap Sort In-Place?

Worst case: O(n log n) Avg case: O(n log n) Best case: O(n log n) Stable

Big-O: Merge Sort In-Place?

Worst case: O(n log n) Avg case: O(n log n) Best case: O(n log n) Unstable

Big-O: Quick Sort In-Place?

Worst case: O(n^2) Avg case: O(n log n) Best case: O(n log n) Stable

Big-O: Bubble Sort In-Place?

Worst case: O(n^2) Avg case: O(n^2) Best case: O(n) Stable

Big-O: Insertion Sort In-Place?

Worst case: O(n^2) Avg case: O(n^2) Best case: O(n^2) Stable

Big-O: Selection Sort In-Place?

Worst case: O(n^2) Avg case: O(n^2) Best case: O(n^2) Unstable

The selection sort is an example of an unstable sorting algorithm.

Yes

Which statement is true about the running time function in its Big O asymptotic notation for the code below? Please note that: 1. The running time function f (n) provides a formula for the number of operations (additions and assignments) done only on the variable sum. 2. The Big-O asymptotic notation is used to classify the algorithm based on the function f (n). 3. Assume that the value of n is the exact power of 8. sum = 0; for(int i = 1; i < n; i *= 8) sum = sum + 1;

f(n)=2log8(n)+1 and f(n)=O(log2(n))


Conjuntos de estudio relacionados

Health Information Management Mid-Term (Part 1)

View Set

Porth's Patho: Disorders of Female Reproductive, Chapter 45

View Set

Student Workbook and Resource Guide for Kozier & Erb's Fundamentals of Nursing, 10/E Chapter 04

View Set

Chapter 44:Digestive and Gastrointestinal Treatment Modalities

View Set