0% found this document useful (0 votes)
5 views

Sorting Algorithms _ DPP 01

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Sorting Algorithms _ DPP 01

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

GATE

CS & IT
Algorithms DPP: 1
Sorting Algorithms

Q1 What is the recurrence relation of insertion sort QS Bubble sort is


when the array is almost sorted with P element? (A) In place sorting technique
(A)T(P)=T( �) + 0(1) (B) Outplace sorting technique
(B)T(P)=T(�) + p 2 (C) Unstable sorting technique
(C)T(P)=2T ( �) + p (D) Stable sorting technique
(D)T(P)=2T (�) +0(1)
Q6 What is the time complxity of selection sort in
Q2 Consider the following array A with 8 elements: best case,average case and worst case
respectively is:

-1 70----.- 1-60----r-l-20--r-l s-o r--14_____


0
I �I 1
1 _s ........-19 2---,1
(A) O(n),O(nlogn),O(n2)
(B) O(n), O(n 2 ), O(n 2)
0 1 2 3 4 5 6 7
(C) O(n 2 ), O(n 2), O(n2 )
What is the index value of elements 60 after 3rd (D) O(n), O(nlogn), O(nlogn)
pass of selection sort? Q7 How many swaps are needed in selection sort to
Q3 Consider the following array with 8 elements: sort n element in worst case?

I 50 160 90 65 55 I I I I
What is result after 3rd pass of bubble sort?
45185 1 12 I (A) n -1
(B) n(n-l)
(C) n
2

(A) 50,60,55,45,12,65,85,90 (D) n 2


(8) 12,45,50,60,90,65,55,85
Q8 Consider the following elements:
(C) 90,85,65,50,60,55,45,12
(D) 50,55,45,60,12,65,85,90 1101 156 1 9341555 18 112 1785123 15 19991
What is the results after 3rd pass of padix sort?

�I 1
Q (A) 56,23,12,8,5,101,55,785,934
4 �
-11--,01-20---r- 5 -
1
o""T"""l 6-0 -r-- 7--,0 6 5----.- 5- 5--r- 2- 5
1 1
.--

1 1
15
---,
(B) 56,23,12,8,5,101,555,785,999,934
(C) 5,8,12,23,56 101,785,555,934,999
How many swaps are needed to sort the array by (D) 5,8,12,23,56,101,555,785,934,999
using is sertion sort __?

CUSTOMER
SlllVKE
Android App I iOS App I PW Website

You might also like