GATE CSE · 2025 · CS
Question 33: Algorithms
Give it a try, then reveal the answer to check your work.
Question 33
CSNAT1 markNeeds review
The pseudocode of a function fun() is given below:
fun(int A[0,...,n-1]) {
for i=0 to n-2
for j=0 to n-i-2
if (A[j]>A[j+1])
then swap A[j] and A[j+1]
}
Let
be an array storing 30 distinct integers in descending order. The number of swap operations that will be performed, if the function fun() is called with
as argument, is __________. (Answer in integer)Log in to check the answer
You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answerEXPLORE & PRACTISE
Paper and topic context
See where this question comes from and choose what to practise next.
2025CS
GATE CSE 2025 · Paper 1
Computer Science and Information Technology · Original paper archive
- Section
- Computer Science and Information Technology
- Question type
- Numerical answer (NAT)
- Marks
- 1 mark
Practise related topics
Explore more previous year questions using this question’s imported topic tags.
computer science
GATE CSE previous year questions
information technology
GATE CSE previous year questions
computing
GATE CSE previous year questions
algorithms
GATE CSE previous year questions
programming data structures
GATE CSE previous year questions
Programming and Data Structures
GATE CSE previous year questions
Comments
Ask a question, share your approach, or help someone understand.
Log in to view the discussion
You’re not logged in. Log in or create an account to see discussions and add comments.