Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Search results for algorithms
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
+
–
4
votes
4
answers
2
NIELIT 2016 DEC Scientist B (CS) - Section B: 16
Two main measures for the efficiency of an algorithm are: Processor and Memory Complexity and Capacity Time and Space Data and Space
Two main measures for the efficiency of an algorithm are:Processor and MemoryComplexity and CapacityTime and SpaceData and Space
admin
84.6k
views
admin
asked
Mar 31, 2020
Algorithms
nielit2016dec-scientistb-cs
algorithms
time-complexity
+
–
89
votes
16
answers
3
GATE CSE 2014 Set 1 | Question: 39
The minimum number of comparisons required to find the minimum and the maximum of $100$ numbers is ________
The minimum number of comparisons required to find the minimum and the maximum of $100$ numbers is ________
go_editor
54.1k
views
go_editor
asked
Sep 28, 2014
Algorithms
gatecse-2014-set1
algorithms
numerical-answers
normal
maximum-minimum
+
–
35
votes
6
answers
4
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
5
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
6
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
+
–
31
votes
6
answers
7
GATE CSE 2008 | Question: 19
The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is: $\text{MNOPQR}$ $\text{NQMPOR}$ $\text{QMNPRO}$ $\text{QMNPOR}$
The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is:$\text{MNOPQR}$...
Kathleen
35.8k
views
Kathleen
asked
Sep 11, 2014
Algorithms
gatecse-2008
normal
algorithms
graph-algorithms
graph-search
+
–
113
votes
9
answers
8
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.2k
views
Arjun
asked
Sep 24, 2014
Algorithms
gatecse-2013
algorithms
sorting
normal
heap-sort
+
–
79
votes
7
answers
9
GATE CSE 2008 | Question: 40
The minimum number of comparisons required to determine if an integer appears more than $\frac{n}{2}$ times in a sorted array of $n$ integers is $\Theta(n)$ $\Theta(\log n)$ $\Theta(\log^*n)$ $\Theta(1)$
The minimum number of comparisons required to determine if an integer appears more than $\frac{n}{2}$ times in a sorted array of $n$ integers is$\Theta(n)$$\Theta(\log n)...
Kathleen
36.7k
views
Kathleen
asked
Sep 12, 2014
Algorithms
gatecse-2008
normal
algorithms
time-complexity
+
–
77
votes
5
answers
10
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.5k
views
Kathleen
asked
Sep 18, 2014
Algorithms
gatecse-2004
algorithms
sorting
asymptotic-notation
easy
+
–
85
votes
18
answers
11
GATE CSE 2016 Set 1 | Question: 39
Let $G$ be a complete undirected graph on $4$ vertices, having $6$ edges with weights being $1, 2, 3, 4, 5,$ and $6$. The maximum possible weight that a minimum weight spanning tree of $G$ can have is __________
Let $G$ be a complete undirected graph on $4$ vertices, having $6$ edges with weights being $1, 2, 3, 4, 5,$ and $6$. The maximum possible weight that a minimum weight s...
Sandeep Singh
35.5k
views
Sandeep Singh
asked
Feb 12, 2016
Algorithms
gatecse-2016-set1
algorithms
spanning-tree
normal
numerical-answers
+
–
47
votes
8
answers
12
GATE CSE 2019 | Question: 37
There are $n$ unsorted arrays: $A_1, A_2, \dots, A_n$. Assume that $n$ is odd.Each of $A_1, A_2, \dots, A_n$ contains $n$ distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of $A_1, A_2, \dots , A_n$ is $O(n)$ $O(n \: \log \: n)$ $O(n^2)$ $\Omega (n^2 \log n)$
There are $n$ unsorted arrays: $A_1, A_2, \dots, A_n$. Assume that $n$ is odd.Each of $A_1, A_2, \dots, A_n$ contains $n$ distinct elements. There are no common elements ...
Arjun
35.3k
views
Arjun
asked
Feb 7, 2019
Algorithms
gatecse-2019
algorithms
time-complexity
2-marks
+
–
72
votes
14
answers
13
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.9k
views
gatecse
asked
Sep 26, 2014
Algorithms
gatecse-2012
algorithms
sorting
normal
+
–
64
votes
15
answers
14
GATE CSE 2007 | Question: 15, ISRO2016-26
Consider the following segment of C-code: int j, n; j = 1; while (j <= n) j = j * 2; The number of comparisons made in the execution of the loop for any $n > 0$ is: $\lceil \log_2n \rceil +1$ $n$ $\lceil \log_2n \rceil$ $\lfloor \log_2n \rfloor +1$
Consider the following segment of C-code:int j, n; j = 1; while (j <= n) j = j * 2;The number of comparisons made in the execution of the loop for any $n 0$ is:$\lceil \...
Arjun
37.2k
views
Arjun
asked
Jul 6, 2016
Algorithms
gatecse-2007
algorithms
time-complexity
normal
isro2016
+
–
61
votes
10
answers
15
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
+
–
59
votes
7
answers
16
GATE CSE 2006 | Question: 12
To implement Dijkstra’s shortest path algorithm on unweighted graphs so that it runs in linear time, the data structure to be used is: Queue Stack Heap B-Tree
To implement Dijkstra’s shortest path algorithm on unweighted graphs so that it runs in linear time, the data structure to be used is:QueueStackHeapB-Tree
Rucha Shelke
31.6k
views
Rucha Shelke
asked
Sep 16, 2014
Algorithms
gatecse-2006
algorithms
graph-algorithms
easy
+
–
66
votes
9
answers
17
GATE CSE 2012 | Question: 40
Consider the directed graph shown in the figure below. There are multiple shortest paths between vertices $S$ and $T$. Which one will be reported by Dijkstra's shortest path algorithm? Assume that, in any iteration, the shortest path to a vertex $v$ is updated only ... a strictly shorter path to $v$ is discovered. $\text{SDT}$ $\text{SBDT}$ $\text{SACDT}$ $\text{SACET}$
Consider the directed graph shown in the figure below. There are multiple shortest paths between vertices $S$ and $T$. Which one will be reported by Dijkstra’s shortest...
gatecse
26.9k
views
gatecse
asked
Sep 26, 2014
Algorithms
gatecse-2012
algorithms
graph-algorithms
normal
+
–
56
votes
8
answers
18
GATE CSE 1996 | Question: 2.13, ISRO2016-28
The average number of key comparisons required for a successful search for sequential search on $n$ items is $\frac{n}{2}$ $\frac{n-1}{2}$ $\frac{n+1}{2}$ None of the above
The average number of key comparisons required for a successful search for sequential search on $n$ items is$\frac{n}{2}$$\frac{n-1}{2}$$\frac{n+1}{2}$None of the above
Kathleen
31.7k
views
Kathleen
asked
Oct 9, 2014
Algorithms
gate1996
algorithms
easy
isro2016
searching
+
–
63
votes
11
answers
19
GATE CSE 2008 | Question: 45
Dijkstra's single source shortest path algorithm when run from vertex $a$ in the above graph, computes the correct shortest path distance to only vertex $a$ only vertices $a, e, f, g, h$ only vertices $a, b, c, d$ all the vertices
Dijkstra's single source shortest path algorithm when run from vertex $a$ in the above graph, computes the correct shortest path distance toonly vertex $a$only vertices $...
Kathleen
27.7k
views
Kathleen
asked
Sep 12, 2014
Algorithms
gatecse-2008
algorithms
graph-algorithms
normal
+
–
42
votes
5
answers
20
GATE CSE 2013 | Question: 31
Consider the following function: int unknown(int n){ int i, j, k=0; for (i=n/2; i<=n; i++) for (j=2; j<=n; j=j*2) k = k + n/2; return (k); } The return value of the function is $\Theta(n^2)$ $\Theta(n^2\log n)$ $\Theta(n^3)$ $\Theta(n^3\log n)$
Consider the following function:int unknown(int n){ int i, j, k=0; for (i=n/2; i<=n; i++) for (j=2; j<=n; j=j*2) k = k + n/2; return (k); }The return value of the functio...
Arjun
29.6k
views
Arjun
asked
Sep 24, 2014
Algorithms
gatecse-2013
algorithms
identify-function
normal
+
–
Page:
1
2
3
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register