Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged sorting
0
votes
1
answer
1
Divide and conquer
In quick sort, n numbers the (n/10)th element is selected as pivot using n^2 sortimng time complexity what will be the time complexity of quick sort is..... a)O(nlogn) b)O(n^2) c)O(n^3) d)O(n)
In quick sort, n numbers the (n/10)th element is selected as pivot using n^2 sortimng time complexity what will be the time complexity of quick sort is.....a)O(nlogn)b)O(...
Emankashyap
99
views
Emankashyap
asked
Apr 30
Algorithms
divide-and-conquer
algorithms
time-complexity
recurrence-relation
sorting
+
–
0
votes
1
answer
2
Sorting Algorithm
For flag based approach in Bubble sort we can check first by a flag if the list is sorted or not in O(n), and if it is sorted, then no need to sort and the operation ends in Best case = O(n). Why isn't the same concept applicable to selection sort? Why it never comes down from O(n$^2$)?
For flag based approach in Bubble sort we can check first by a flag if the list is sorted or not in O(n), and if it is sorted, then no need to sort and the operation ends...
Mrityudoot
236
views
Mrityudoot
asked
Mar 7
Algorithms
algorithms
sorting
time-complexity
asymptotic-notation
+
–
0
votes
1
answer
3
GATE DS&AI 2024 | Question: 35
Consider the following sorting algorithms: Bubble sort Insertion sort Selection sort Which ONE among the following choices of sorting algorithms sorts the numbers in the array $[4,3,2,1,5]$ in increasing order after exactly two passes over the array? $\text{(i)}$ only $\text{(iii)}$ only $\text{(i)}$ and $\text{(iii)}$ only $\text{(ii)}$ and $\text{(iii)}$ only
Consider the following sorting algorithms:Bubble sortInsertion sortSelection sortWhich ONE among the following choices of sorting algorithms sorts the numbers in the arra...
Arjun
939
views
Arjun
asked
Feb 16
Algorithms
gate-ds-ai-2024
algorithms
sorting
+
–
1
votes
2
answers
4
GATE CSE 2024 | Set 2 | Question: 25
Let $\text{A}$ be an array containing integer values. The distance of $\text{A}$ is defined as the minimum number of elements in $\text{A}$ that must be replaced with another integer so that the resulting array is sorted in non-decreasing order. The distance of the array $[2,5,3,1,4,2,6]$ is ___________.
Let $\text{A}$ be an array containing integer values. The distance of $\text{A}$ is defined as the minimum number of elements in $\text{A}$ that must be replaced with ano...
Arjun
2.7k
views
Arjun
asked
Feb 16
Algorithms
gatecse2024-set2
numerical-answers
algorithms
sorting
+
–
0
votes
0
answers
5
GATE 2024
Consider an n element array which is to be sorted either in ascending or descending order. The given restriction is only one pass will be used for completely sorting the array and an element can compare with only it's adjacent pair. What will be the worst time complexity? Is this related to bubble sort algorithm or not?
Consider an n element array which is to be sorted either in ascending or descending order. The given restriction is only one pass will be used for completely sorting the ...
TusharRana
436
views
TusharRana
asked
Feb 11
Algorithms
algorithms
sorting
+
–
2
votes
2
answers
6
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 20
Consider the following array$: [32, 33, 5, 2, 14, -4, 22, 39, 34, -9].$ ... sorting algorithms could we possibly have applied? Merge sort (top-down approach) Bubble sort Quicksort (Using First element as pivot) Insertion sort
Consider the following array$: [32, 33, 5, 2, 14, -4, 22, 39, 34, -9].$ We apply a certain sorting algorithm and observe that the array has been modified to $[2, 5, 14, 3...
GO Classes
619
views
GO Classes
asked
Feb 5
Algorithms
goclasses2024-mockgate-14
algorithms
sorting
merge-sort
multiple-selects
1-mark
+
–
3
votes
0
answers
7
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 47
A $\text{stable sort}$ preserves the order of values that are equal with respect to the comparison function. We have a list of three-dimensional points $[(7, 1, 8),(3, 5, 7),(6, 1, 4),(6, 5, 9),(0, 2, 5),(9, 0, 9)].$ We sort these in ascending order by the ... $[(9, 0, 9),(6, 1, 4),(7, 1, 8),(0, 2, 5),(3, 5, 7),(6, 5, 9)]$
A $\text{stable sort}$ preserves the order of values that are equal with respect to the comparison function. We have a list of three-dimensional points$[(7, 1, 8),(3, 5, ...
GO Classes
231
views
GO Classes
asked
Feb 5
Algorithms
goclasses2024-mockgate-14
algorithms
sorting
2-marks
+
–
0
votes
0
answers
8
Memory Based GATE DA 2024 | Question: 22
Given the array \( [4, 3, 2, 1, 5] \), which of the following sorting algorithms can successfully sort the array in exactly two passes? Bubble Sort Insertion Sort Selection Sort Merge Sort
Given the array \( [4, 3, 2, 1, 5] \), which of the following sorting algorithms can successfully sort the array in exactly two passes?Bubble SortInsertion Sort Selectio...
GO Classes
175
views
GO Classes
asked
Feb 4
Algorithms
gate2024-da-memory-based
goclasses
algorithms
sorting
+
–
5
votes
2
answers
9
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 29
Consider an array that has $10$ distinct elements. Suppose we use randomized quicksort (with the pivot chosen uniformly at random). What is the probability that the partition method will result in an array such that the size of the ... the left and one on the right of the chosen pivot. The pivot itself is not part of any subarray.
Consider an array that has $10$ distinct elements. Suppose we use randomized quicksort (with the pivot chosen uniformly at random). What is the probability that the parti...
GO Classes
688
views
GO Classes
asked
Jan 21
Algorithms
goclasses2024-mockgate-12
goclasses
numerical-answers
algorithms
sorting
quick-sort
2-marks
+
–
3
votes
1
answer
10
GO Classes Test Series 2024 | Mock GATE | Test 11 | Question: 24
Here is an array of ten integers$: 5389170264$ Suppose we run MergeSort on this array. What is the number in the $7$th position of the partially sorted array after the outermost two recursive calls have completed (i.e., just before the very last Merge ... for example, the input array has a $0$ in its $7$th position.) $3$ $1$ $2$ $4$
Here is an array of ten integers$: 5389170264$Suppose we run MergeSort on this array. What is the number in the $7$th position of the partially sorted array after the out...
GO Classes
416
views
GO Classes
asked
Jan 13
Algorithms
goclasses2024-mockgate-11
goclasses
algorithms
sorting
merge-sort
1-mark
+
–
8
votes
1
answer
11
GO Classes Test Series 2024 | Mock GATE | Test 11 | Question: 49
An inversion in an array $a$ is a pair of array indices $(i, j)$ such that $i<j$ but $a[i]>a[j]$. What is the maximum number of inversions that can be eliminated by the following program fragment? tmp = a[5] ; a[5] = a[10] ; a[10]= tmp ; $5$ $6$ $9$ $20$
An inversion in an array $a$ is a pair of array indices $(i, j)$ such that $i<j$ but $a[i]>a[j]$.What is the maximum number of inversions that can be eliminated by the fo...
GO Classes
606
views
GO Classes
asked
Jan 13
Algorithms
goclasses2024-mockgate-11
goclasses
algorithms
sorting
2-marks
+
–
0
votes
1
answer
12
ISRO 2024
Worst case time complexity of heap sort for n elements O(nlogn) O(logn) O^2 O(n)
Worst case time complexity of heap sort for n elementsO(nlogn)O(logn)O^2O(n)
Ramayya
207
views
Ramayya
asked
Jan 7
Algorithms
isro-2024
algorithms
heap-sort
sorting
+
–
1
votes
1
answer
13
UGC NET CSE | June 2008 | Part 2 | Question: 23
Which of the following is true for a sorted list with ' $n$ ... $\mathrm{O}(\log n)$ time.
Which of the following is true for a sorted list with ' $n$ ' elements?Insertion in a sorted array takes constant time.Insertion in a sorted linear linked list takes cons...
admin
176
views
admin
asked
Jan 6
Others
ugcnetcse-june2008-paper2
sorting
array
time-complexity
+
–
1
votes
1
answer
14
Self doubt
#include <stdio.h> void SSort(int [], int); void swap(int *,int*); int main() { int arr[] = {5,4,3,2,1,0}; int n = sizeof(arr)/sizeof(arr[0]); SSort(arr,n); for(int i = 0; i < n; i++) { printf("%d\t", arr[i]); } return 0; } void SSort( ... = *x; *x = *y; *y = tmp; } This is a selection sort algorithm. But the output of the algo is: 0 0 0 0 0 0. Where is the problem ?
#include <stdio.h>void SSort(int [], int);void swap(int *,int*);int main() { int arr[] = {5,4,3,2,1,0}; int n = sizeof(arr)/sizeof(arr[0]); SSort(arr,n); for(...
Gopal6854
349
views
Gopal6854
asked
Sep 13, 2023
DS
sorting
self-doubt
algorithms
+
–
0
votes
2
answers
15
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). How many comparisons are needed in the worst case scenario to determine that the key is not in the array?
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). ...
dhruba
1.2k
views
dhruba
asked
Jun 5, 2023
Algorithms
algorithms
binary-search
sorting
+
–
0
votes
1
answer
16
Combinatorics, Discrete Maths (self doubts)
Consider the set of 4 -digit positive integers. How many of them have their digits in :- a) strictly decreasing order ? b) non decreasing order ? c) non increasing order ?
Consider the set of 4 -digit positive integers. How many of them have their digits in :-a) strictly decreasing order ?b) non decreasing order ?c) non increasing order ?...
Swarnava Bose
429
views
Swarnava Bose
asked
Jun 3, 2023
Combinatory
combinatory
sorting
discrete-mathematics
goclasses
+
–
0
votes
0
answers
17
Algorithm
Çșȇ ʛấẗẻ
309
views
Çșȇ ʛấẗẻ
asked
May 11, 2023
Algorithms
algorithms
time-complexity
sorting
+
–
4
votes
2
answers
18
GO Classes 2023 | IIITH Mock Test 1 | Question: 8
If we have an array of size $\mathrm{N}$ with only $3$ different values for its elements, what is the probability that the first partition results in a completely sorted array? Assume there are an equal number of each element in the array. $1 / 2$ $1 / 3$ $1 / 4$ $2 / 3$
If we have an array of size $\mathrm{N}$ with only $3$ different values for its elements, what is the probability that the first partition results in a completely sorted ...
GO Classes
1.1k
views
GO Classes
asked
Mar 26, 2023
Algorithms
goclasses2023-iiith-mock-1
goclasses
algorithms
sorting
array
1-mark
+
–
1
votes
1
answer
19
GO Classes 2023 | IIITH Mock Test 1 | Question: 43
Recall the Partition subroutine that we used in QuickSort. Suppose that the following array has just been partitioned around some pivot element $: 3,1,2,4,5,8,7,6,9.$ Which of these element(s) could have been the pivot element? $4$ $5$ $2$ $9$
Recall the Partition subroutine that we used in QuickSort. Suppose that the following array has just been partitioned around some pivot element $: 3,1,2,4,5,8,7,6,9.$Whic...
GO Classes
1.0k
views
GO Classes
asked
Mar 26, 2023
Algorithms
goclasses2023-iiith-mock-1
goclasses
algorithms
sorting
quick-sort
easy
multiple-selects
1-mark
+
–
Page:
1
2
3
4
5
6
...
19
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register