Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. What is the best running time of any sorting algorithm if comparison is used? a. O(log n)b. O(n)c. O(n log n)d. O(n 2 )e.

1. What is the best running time of any sorting algorithm if comparison is used?

a. O(log n)b. O(n)c. O(n log n)d. O(n2)e. O(n2logn)

2. Which of the following represents the recurrence relation of a quicksort with sorted inputs in increasing order when the last element is a pivot?

a. T(n) = T(n/2) + O(1)

b. T(n) = T(n/2) + O(n)

c. T(n) = 2* T(n/2) + O(n)

d. T(n) = T(0) + T(n-1) + O(n)

e. T(n) = T(n-1) + T(n-2) + O(1)

3. What is the worst-case depth of recursion tree for merge sort?

O(n)

O(log n)

O(nlog n)

O(n2)

O(n-1)

4. Which of the following can achieve a linear time for time complexity?

a. Mergesort

b. Quicksort

c. AVL sort

d. Counting sort

e. Bubble sort

5. Write a recurrence relation for the Merge sort and solve the running time.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

7. Do the organizations social activities reflect diversity?

Answered: 1 week ago

Question

What qualities do you see as necessary for your line of work?

Answered: 1 week ago