Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Search results for sorting
15
votes
1
answer
1
How to find number of swappings in bubble sort in least possible time ( any shortcut available )
1. The number of swappings needed to sort the numbers: 8, 22, 7, 9, 31, 19, 5, 13 in ascending order using bubble sort is- (a) 11 (b) 12 (c) 13 (d) 14 I know how to solve it using ... I did was to write every pass and check the swappings. But , it takes too much time. Is there any shortcut possible ?
1. The number of swappings needed to sort the numbers: 8, 22, 7, 9, 31, 19, 5, 13 in ascending order using bubble sort is—(a) 11 (b) 12(c) 13 (d) 14I know how to solve ...
worst_engineer
166k
views
worst_engineer
asked
Aug 2, 2015
Algorithms
sorting
algorithms
bubble-sort
+
–
35
votes
6
answers
2
GATE CSE 1995 | Question: 1.16
For merging two sorted lists of sizes $m$ and $n$ into a sorted list of size $m+n$, we require comparisons of $O(m)$ $O(n)$ $O(m+n)$ $O(\log m + \log n)$
For merging two sorted lists of sizes $m$ and $n$ into a sorted list of size $m+n$, we require comparisons of$O(m)$$O(n)$$O(m+n)$$O(\log m + \log n)$
Kathleen
47.9k
views
Kathleen
asked
Oct 8, 2014
Algorithms
gate1995
algorithms
sorting
normal
+
–
19
votes
8
answers
3
Minimum number of comparisons required to sort 5 elements is
The minimum number of comparisons required to sort 5 elements is - 4 5 6 7
The minimum number of comparisons required to sort 5 elements is -4567
piyushkr
43.6k
views
piyushkr
asked
Dec 30, 2015
Algorithms
algorithms
sorting
+
–
44
votes
4
answers
4
GATE CSE 2006 | Question: 52
The median of $n$ elements can be found in $O(n)$ time. Which one of the following is correct about the complexity of quick sort, in which median is selected as pivot? $\Theta (n)$ $\Theta (n \log n)$ $\Theta (n^{2})$ $\Theta (n^{3})$
The median of $n$ elements can be found in $O(n)$ time. Which one of the following is correct about the complexity of quick sort, in which median is selected as pivot?$\T...
Rucha Shelke
53.4k
views
Rucha Shelke
asked
Sep 26, 2014
Algorithms
gatecse-2006
algorithms
sorting
easy
+
–
113
votes
9
answers
5
GATE CSE 2013 | Question: 30
The number of elements that can be sorted in $\Theta(\log n)$ time using heap sort is $\Theta(1)$ $\Theta(\sqrt{\log} n)$ $\Theta(\frac{\log n}{\log \log n})$ $\Theta(\log n)$
The number of elements that can be sorted in $\Theta(\log n)$ time using heap sort is$\Theta(1)$$\Theta(\sqrt{\log} n)$$\Theta(\frac{\log n}{\log \log n})$$\Theta(\log n)...
Arjun
28.1k
views
Arjun
asked
Sep 24, 2014
Algorithms
gatecse-2013
algorithms
sorting
normal
heap-sort
+
–
77
votes
5
answers
6
GATE CSE 2004 | Question: 29
The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of $n$ $n^2$ $n \log n$ $n \log^2n$
The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of$n$$n^2$$n \log n$$n \log^2n$
Kathleen
33.4k
views
Kathleen
asked
Sep 18, 2014
Algorithms
gatecse-2004
algorithms
sorting
asymptotic-notation
easy
+
–
72
votes
14
answers
7
GATE CSE 2012 | Question: 39
A list of $n$ strings, each of length $n$, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is $O (n \log n) $ $ O(n^{2} \log n) $ $ O(n^{2} + \log n) $ $ O(n^{2}) $
A list of $n$ strings, each of length $n$, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is$O (n \log...
gatecse
28.8k
views
gatecse
asked
Sep 26, 2014
Algorithms
gatecse-2012
algorithms
sorting
normal
+
–
61
votes
10
answers
8
GATE CSE 2014 Set 3 | Question: 14
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(n^2)$ $O(n \log n)$ $\Theta(n\log n)$ $O(n^3)$
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...
go_editor
30.9k
views
go_editor
asked
Sep 28, 2014
Algorithms
gatecse-2014-set3
algorithms
sorting
easy
+
–
75
votes
15
answers
9
GATE CSE 2005 | Question: 39
Suppose there are $\lceil \log n \rceil$ sorted lists of $\lfloor n /\log n \rfloor$ elements each. The time complexity of producing a sorted list of all these elements is: (Hint:Use a heap data structure) $O(n \log \log n)$ $\Theta(n \log n)$ $\Omega(n \log n)$ $\Omega\left(n^{3/2}\right)$
Suppose there are $\lceil \log n \rceil$ sorted lists of $\lfloor n /\log n \rfloor$ elements each. The time complexity of producing a sorted list of all these elements i...
gatecse
26.4k
views
gatecse
asked
Sep 15, 2014
Algorithms
gatecse-2005
algorithms
sorting
normal
+
–
86
votes
8
answers
10
GATE CSE 2014 Set 2 | Question: 38
Suppose $P, Q, R, S, T$ are sorted sequences having lengths $20, 24, 30, 35, 50$ respectively. They are to be merged into a single sequence by merging together two sequences at a time. The number of comparisons that will be needed in the worst case by the optimal algorithm for doing this is ____.
Suppose $P, Q, R, S, T$ are sorted sequences having lengths $20, 24, 30, 35, 50$ respectively. They are to be merged into a single sequence by merging together two sequen...
go_editor
24.9k
views
go_editor
asked
Sep 28, 2014
Algorithms
gatecse-2014-set2
algorithms
sorting
normal
numerical-answers
+
–
66
votes
7
answers
11
GATE IT 2008 | Question: 43
If we use Radix Sort to sort $n$ integers in the range $\left (n^{k/2}, n^k \right ]$, for some $k > 0$ which is independent of $n$, the time taken would be? $\Theta(n)$ $\Theta(kn)$ $\Theta(n \log n)$ $\Theta(n^2)$
If we use Radix Sort to sort $n$ integers in the range $\left (n^{k/2}, n^k \right ]$, for some $k 0$ which is independent of $n$, the time taken would be?$\Theta(n)$$\T...
Ishrat Jahan
20.7k
views
Ishrat Jahan
asked
Oct 28, 2014
Algorithms
gateit-2008
algorithms
sorting
normal
+
–
2
votes
4
answers
12
NIELIT 2016 DEC Scientist B (CS) - Section B: 12
The running time of Quick sort algorithm depends heavily on the selection of: No. of inputs Arrangement of elements in an array Size of elements Pivot Element
The running time of Quick sort algorithm depends heavily on the selection of:No. of inputsArrangement of elements in an arraySize of elementsPivot Element
admin
15.2k
views
admin
asked
Mar 31, 2020
Algorithms
nielit2016dec-scientistb-cs
algorithms
sorting
quick-sort
+
–
14
votes
6
answers
13
GATE CSE 2021 Set 1 | Question: 9
Consider the following array.$\begin{array}{|l|l|l|l|l|l|} \hline 23&32&45&69&72&73&89&97 \\ \hline\end{array}$ Which algorithm out of the following options uses the least number of comparisons ( ... elements) to sort the above array in ascending order? Selection sort Mergesort Insertion sort Quicksort using the last element as pivot
Consider the following array.$$\begin{array}{|l|l|l|l|l|l|} \hline 23&32&45&69&72&73&89&97 \\ \hline\end{array}$$ Which algorithm out of the following options uses the le...
Arjun
12.3k
views
Arjun
asked
Feb 18, 2021
Algorithms
gatecse-2021-set1
algorithms
sorting
1-mark
+
–
55
votes
7
answers
14
GATE CSE 2015 Set 2 | Question: 45
Suppose you are provided with the following function declaration in the C programming language. int partition(int a[], int n); The function treats the first element of $a[\:]$ as a pivot and rearranges the array so that all elements less than or equal to the pivot is in the ... $(a, $ left_end$, k)$ $(a, n-$left_end$-1, k-$left_end$-1)$ and $(a, $left_end$, k)$
Suppose you are provided with the following function declaration in the C programming language.int partition(int a[], int n);The function treats the first element of $a[\...
go_editor
16.6k
views
go_editor
asked
Feb 13, 2015
Algorithms
gatecse-2015-set2
algorithms
normal
sorting
+
–
39
votes
4
answers
15
GATE CSE 2006 | Question: 14, ISRO2011-14
Which one of the following in place sorting algorithms needs the minimum number of swaps? Quick sort Insertion sort Selection sort Heap sort
Which one of the following in place sorting algorithms needs the minimum number of swaps?Quick sortInsertion sortSelection sortHeap sort
Rucha Shelke
25.4k
views
Rucha Shelke
asked
Sep 17, 2014
Algorithms
gatecse-2006
algorithms
sorting
easy
isro2011
+
–
70
votes
9
answers
16
GATE CSE 2003 | Question: 62
In a permutation $a_1\ldots a_n$, of $n$ distinct integers, an inversion is a pair $(a_i, a_j)$ such that $i < j$ and $a_i > a_j.$ What would be the worst case time complexity of the Insertion Sort algorithm, if the inputs are restricted to permutations of $1. . . n$ with at most $n$ inversions? $\Theta(n^2)$ $\Theta(n\log n)$ $\Theta(n^{1.5})$ $\Theta(n)$
In a permutation $a_1\ldots a_n$, of $n$ distinct integers, an inversion is a pair $(a_i, a_j)$ such that $i < j$ and $a_i a_j.$What would be the worst case time complex...
go_editor
19.8k
views
go_editor
asked
Apr 24, 2016
Algorithms
gatecse-2003
algorithms
sorting
normal
insertion-sort
+
–
30
votes
2
answers
17
GATE CSE 2009 | Question: 11
What is the number of swaps required to sort $n$ elements using selection sort, in the worst case? $\Theta(n)$ $\Theta(n \log n)$ $\Theta(n^2)$ $\Theta(n^2 \log n)$
What is the number of swaps required to sort $n$ elements using selection sort, in the worst case?$\Theta(n)$$\Theta(n \log n)$$\Theta(n^2)$$\Theta(n^2 \log n)$
Kathleen
27.8k
views
Kathleen
asked
Sep 22, 2014
Algorithms
gatecse-2009
algorithms
sorting
easy
+
–
59
votes
5
answers
18
GATE CSE 2015 Set 3 | Question: 27
Assume that a mergesort algorithm in the worst case takes $30$ seconds for an input of size $64$. Which of the following most closely approximates the maximum input size of a problem that can be solved in $6$ minutes? $256$ $512$ $1024$ $2018$
Assume that a mergesort algorithm in the worst case takes $30$ seconds for an input of size $64$. Which of the following most closely approximates the maximum input size ...
go_editor
20.1k
views
go_editor
asked
Feb 15, 2015
Algorithms
gatecse-2015-set3
algorithms
sorting
+
–
66
votes
12
answers
19
GATE CSE 2003 | Question: 61
In a permutation \(a_1 ... a_n\), of n distinct integers, an inversion is a pair \((a_i, a_j)\) such that \(i < j\) and \(a_i > a_j\). If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of \(1. . . n\)? \(\frac{n(n-1)}{2}\) \(\frac{n(n-1)}{4}\) \(\frac{n(n+1)}{4}\) \(2n[\log_2n]\)
In a permutation \(a_1 ... a_n\), of n distinct integers, an inversion is a pair \((a_i, a_j)\) such that \(i < j\) and \(a_i a_j\).If all permutations are equally likel...
Kathleen
22.0k
views
Kathleen
asked
Sep 17, 2014
Algorithms
gatecse-2003
algorithms
sorting
inversion
normal
+
–
42
votes
6
answers
20
GATE CSE 2000 | Question: 17
An array contains four occurrences of $0$, five occurrences of $1$, and three occurrences of $2$ in any order. The array is to be sorted using swap operations (elements that are swapped need to be adjacent). What is the minimum number of swaps ... ? Give an ordering of elements in the above array so that the minimum number of swaps needed to sort the array is maximum.
An array contains four occurrences of $0$, five occurrences of $1$, and three occurrences of $2$ in any order. The array is to be sorted using swap operations (elements t...
Kathleen
11.0k
views
Kathleen
asked
Sep 14, 2014
Algorithms
gatecse-2000
algorithms
sorting
normal
descriptive
+
–
Page:
1
2
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register