Question: 1. Given a sorted input of size n. Write time complexity (using notation) for each of the algorithms on the given input (a sorted input

1. Given a sorted input of size n. Write time complexity (using notation) for each of the algorithms on the given input (a sorted input of size n):

Insertion Sort

Selection Sort

Bubble Sort

Merge Sort

Quick Sort

Counting Sort

Which of the algorithms has the best performance (best running time)? Explain your answer!

2. Given a reverse-ordered input of size n. Write time complexity (using notation) for each of the algorithms on the given input (a sorted input of size n):

Insertion Sort

Selection Sort

Bubble Sort

Merge Sort

Quick Sort

Counting Sort

Which of the algorithms has the best performance (best running time)? Explain your answer

3. Given an input of n numbers. The numbers are positive integers and bounded by 3n2 (each input value is less or equal to 3n2). Analyze time complexity of Counting Sort on the given input. Explain your answer!

4. Given an input of n numbers. The numbers are written in decimal system using up to 3n digits. Analyze time complexity of RadixSort on the given input. Explain your answer!

5. Given a reverse-ordered input and search key K. Modify the Sequential Search of a Sorted Array Algorithm such that it works on the given reverse-ordered input of size n. Write the pseudocode for it.

6. Given a reverse-ordered input and search key K. Modify the Binary Search of a Sorted Array Algorithm such that it works on the given reverse-ordered input of size n. Write the pseudocode for it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!