Login
Register
@
Dark Mode
Profile
Edit my Profile
Messages
My favorites
Register
Activity
Q&A
Questions
Unanswered
Tags
Subjects
Users
Ask
Previous Years
Blogs
New Blog
Exams
Dark Mode
Recent questions tagged sorting
0
votes
1
answer
1
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$)?
Mrityudoot
asked
in
Algorithms
Mar 7
by
Mrityudoot
92
views
algorithms
sorting
time-complexity
asymptotic-notation
0
votes
1
answer
2
GATE DS&AI 2024 | Question: 35
Consider the following sorting algorithms: (i) Bubble sort (ii) Insertion sort (iii) 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? ... after exactly two passes over the array? (i) only (iii) only (i) and (iii) only (ii) and (iii) only
Arjun
asked
in
Algorithms
Feb 17
by
Arjun
768
views
gate-ds-ai-2024
algorithms
sorting
1
vote
2
answers
3
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 ___________.
Arjun
asked
in
Algorithms
Feb 16
by
Arjun
1.8k
views
gatecse2024-set2
numerical-answers
algorithms
sorting
0
votes
0
answers
4
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?
TusharRana
asked
in
Algorithms
Feb 11
by
TusharRana
329
views
algorithms
sorting
2
votes
2
answers
5
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
GO Classes
asked
in
Algorithms
Feb 5
by
GO Classes
482
views
goclasses2024-mockgate-14
algorithms
sorting
merge-sort
multiple-selects
1-mark
3
votes
0
answers
6
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)]$
GO Classes
asked
in
Algorithms
Feb 5
by
GO Classes
180
views
goclasses2024-mockgate-14
algorithms
sorting
2-marks
0
votes
0
answers
7
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
GO Classes
asked
in
Algorithms
Feb 5
by
GO Classes
134
views
gate2024-da-memory-based
goclasses
algorithms
sorting
5
votes
2
answers
8
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.
GO Classes
asked
in
Algorithms
Jan 21
by
GO Classes
602
views
goclasses2024-mockgate-12
goclasses
numerical-answers
algorithms
sorting
quick-sort
2-marks
3
votes
1
answer
9
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$
GO Classes
asked
in
Algorithms
Jan 13
by
GO Classes
333
views
goclasses2024-mockgate-11
goclasses
algorithms
sorting
merge-sort
1-mark
8
votes
1
answer
10
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$
GO Classes
asked
in
Algorithms
Jan 13
by
GO Classes
537
views
goclasses2024-mockgate-11
goclasses
algorithms
sorting
2-marks
0
votes
1
answer
11
ISRO 2024
Worst case time complexity of heap sort for n elements O(nlogn) O(logn) O^2 O(n)
Ramayya
asked
in
Algorithms
Jan 7
by
Ramayya
171
views
isro-2024
algorithms
heap-sort
sorting
1
vote
1
answer
12
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.
admin
asked
in
Others
Jan 7
by
admin
116
views
ugcnetcse-june2008-paper2
sorting
array
time-complexity
1
vote
1
answer
13
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 ?
Gopal6854
asked
in
DS
Sep 13, 2023
by
Gopal6854
320
views
sorting
self-doubt
algorithms
0
votes
2
answers
14
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?
dhruba
asked
in
Algorithms
Jun 6, 2023
by
dhruba
1.1k
views
algorithms
binary-search
sorting
0
votes
1
answer
15
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 ?
Swarnava Bose
asked
in
Combinatory
Jun 3, 2023
by
Swarnava Bose
375
views
combinatory
sorting
discrete-mathematics
goclasses
0
votes
0
answers
16
Algorithm
Çșȇ ʛấẗẻ
asked
in
Algorithms
May 11, 2023
by
Çșȇ ʛấẗẻ
288
views
algorithms
time-complexity
sorting
3
votes
2
answers
17
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$
GO Classes
asked
in
Algorithms
Mar 26, 2023
by
GO Classes
610
views
goclasses2023-iiith-mock-1
goclasses
algorithms
sorting
array
1-mark
1
vote
1
answer
18
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$
GO Classes
asked
in
Algorithms
Mar 26, 2023
by
GO Classes
754
views
goclasses2023-iiith-mock-1
goclasses
algorithms
sorting
quick-sort
easy
multiple-selects
1-mark
Page:
1
2
3
4
5
6
...
19
next »
Subscribe to GATE CSE 2024 Test Series
Subscribe to GO Classes for GATE CSE 2024
Quick search syntax
tags
tag:apple
author
user:martin
title
title:apple
content
content:apple
exclude
-tag:apple
force match
+apple
views
views:100
score
score:10
answers
answers:2
is accepted
isaccepted:true
is closed
isclosed:true
Recent Posts
Post GATE 2024 Guidance [Counseling tips and resources]
GATE CSE 2024 Result Responses
[Project Contest] Pytorch backend support for MLCommons Cpp Inference implementation
Participating in MLCommons Inference v4.0 submission (deadline is February 23 12pm IST)
IIITH PGEE 2024 Test Series by GO Classes
Subjects
All categories
General Aptitude
(3.5k)
Engineering Mathematics
(10.4k)
Digital Logic
(3.6k)
Programming and DS
(6.2k)
Algorithms
(4.8k)
Theory of Computation
(6.9k)
Compiler Design
(2.5k)
Operating System
(5.2k)
Databases
(4.8k)
CO and Architecture
(4.0k)
Computer Networks
(4.9k)
Artificial Intelligence
(79)
Machine Learning
(48)
Data Mining and Warehousing
(24)
Non GATE
(1.4k)
Others
(2.7k)
Admissions
(682)
Exam Queries
(1.6k)
Tier 1 Placement Questions
(17)
Job Queries
(80)
Projects
(11)
Unknown Category
(870)
64.3k
questions
77.9k
answers
243k
comments
79.6k
users
Recent questions tagged sorting
Recent Blog Comments
Hlo I'm Rupesh I got AIR 3485 in gate CS and AIR...
@Ajay Sasank here is the direct link...
Thank you for the post didi My GATE 2023 & 2024...
I Hope it helps 😊
Today's best post I seen thank you for motivation