
Quick sort algorithm

Quiz
•
Computers
•
University
•
Hard
anas alshorman
Used 98+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is recurrence for worst case of QuickSort and what is the time complexity in Worst case?
Recurrence is T(n) = T(n-2) + O(n) and time complexity is O(n^2)
Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
Recurrence is T(n) = 2T(n/2) + O(n) and time complexity is O(nLogn)
Recurrence is T(n) = T(n/10) + T(9n/10) + O(n) and time complexity is O(nLogn)
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose we have a O(n) time algorithm that finds median of an unsorted array. Now consider a QuickSort implementation where we first find median using the above algorithm, then use median as pivot. What will be the worst case time complexity of this modified QuickSort.
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Let P be a QuickSort Program to sort numbers in ascending order using the first element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4, 1, 5, 3, 2} respectively. Which one of the following holds?
t1 = 5
t1 < t2
t1 > t2
t1 = t2
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
You have an array of n elements. Suppose you implement quicksort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is
O(n2)
O(nLogn)
Theta(nLogn)
O(n3)
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Suppose we have a O(n) time algorithm that finds median of an unsorted array. Now consider a QuickSort implementation where we first find median using the above algorithm, then use median as pivot. What will be the worst case time complexity of this modified QuickSort.
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst case complexity of sorting n numbers using randomized quicksort?
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Quicksort is run on two inputs shown below to sort in ascending order taking first element as pivot,
(i) 1, 2, 3,......., n
(ii) n, n-1, n-2,......, 2, 1
Let C1 and C2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,
C1 < C2
C1 > C2
C1 = C2
We cannot say anything for arbitrary n
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Quiz despre B Tree

Quiz
•
University
10 questions
Complexity Quizz

Quiz
•
University
7 questions
Data Structure 1

Quiz
•
University
9 questions
Asymptomatic Efficiency

Quiz
•
University
10 questions
Algorithm analysis: divide & conquer theory

Quiz
•
University
10 questions
DAA-Test L2

Quiz
•
University
10 questions
DAA_C_MCQ_2

Quiz
•
University
8 questions
TEAM 2

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University