Sorting - IV year
Quiz
•
Computers
•
Professional Development
•
Practice Problem
•
Hard
PRADHEEBA U
Used 11+ times
FREE Resource
Enhance your content in a minute
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Consider the following set of integers.
{20,25,57,48,37,12,92,86,33}
If one uses the quick sort algorithm to sort the above set of integers, how many p to completely sort the file?
5
8
3
9
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Mergesort makes two recursive calls. Which statement is true after these recursive calls finish, but before the merge step ?
Elements in each half of the array are sorted themselves
Array elements form a heap
Elements in first half are greater than second half
None of these
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A newspaper route has recently been computerized. Information about each of the 100 customers is stored in individual records containing first name, last name, and payment due. In writing a computer program to process the customer records, the programmer is uncertain whether to add a procedure to sort the records.If the records are first sorted, what will be the maximum number of comparisons needed with a binary search to find a particular customer's record? ?
7
5
50
100
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How can you improve the best case efficiency in bubble sort? (The input is already sorted)
boolean swapped = false;
for(int j=arr.length-1; j>=0 && swapped; j--)
{
swapped = true;
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
swapped = false;
}
}
}
boolean swapped = true;
for(int j=arr.length-1; j>=0 && swapped; j--)
{
swapped = false;
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}
boolean swapped = true;
for(int j=arr.length-1; j>=0 && swapped; j--)
{
swapped = false;
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
swapped = true;
}
}
}
boolean swapped = true;
for(int j=arr.length-1; j>=0 && swapped; j--)
{
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
swapped = true;
}
}
}
5.
MULTIPLE CHOICE QUESTION
30 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) = 2T(n/2) + O(n) and time complexity is O(nLogn)
Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
Recurrence is T(n) = T(n/10) + T(9n/10) + O(n) and time complexity is O(nLogn)
6.
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.
O(n^2 Logn)
BO(n^2)
CO(n Logn Logn)
O(nLogn)
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
The number of elements that can be sorted in o(log n) time using heap sort is
o(1)
o( )
o(Log n/log log n)
o(Log n)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
Test SQL
Quiz
•
Professional Development
20 questions
KEYBOARDING QUIZ
Quiz
•
Professional Development
15 questions
Pretest Latihan Soal Excel
Quiz
•
Professional Development
16 questions
L4 Ôn tập HK 2 - 22-23
Quiz
•
Professional Development
20 questions
Banco de Dados - Modelo Entidade Relacionamento
Quiz
•
Professional Development
15 questions
Sensibilisation sécurité informatique
Quiz
•
Professional Development
18 questions
Word - Revisão
Quiz
•
Professional Development
16 questions
Keyboard Types
Quiz
•
Professional Development
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
Discover more resources for Computers
20 questions
Black History Month Trivia Game #1
Quiz
•
Professional Development
100 questions
Screening Test Customer Service
Quiz
•
Professional Development
20 questions
90s Cartoons
Quiz
•
Professional Development
10 questions
Reading a ruler in Inches
Quiz
•
4th Grade - Professio...
16 questions
Parallel, Perpendicular, and Intersecting Lines
Quiz
•
KG - Professional Dev...
12 questions
Valentines Day Trivia
Quiz
•
Professional Development
