GATE CS Algorithms questions
Practise Algorithms questions for GATE CS. Explore official PYQs and original subject-wise quizzes, check answers and view available solutions. Free, no sign-in.
Compare greedy choices, dynamic-programming states and graph algorithms. Identify the input size before analysing the time and space complexity of each solution.
Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.
20 on this page
Consider the following functions Which of the following is true?
Suppose you are given an array and a procedure reverse which reverses the order of elements in between positions and (both inclusive). What does the following sequence do, where : reverse (s, 1, k); reverse (s, k+1, n); reverse (s, 1, n);
Let be a sorted array of integers. Let denote the time taken for the most efficient algorithm to determined if there are two elements with sum less than in . Which of the following statement is true?
The most appropriate matching for the following pairs is:
Consider the following function definition int Trial (int a, int b, int c) { if ((a>=b) && (c<b)) return b; else if (a>=b) return Trial(a, c, b); else return Trial(b, a, c); } The functional Trial:
If , give the correct matching for the following pairs: …
If is a power of , then the minimum number of multiplications needed to compute is
If one uses straight two-way merge sort algorithm to sort the following elements in ascending order: then the order of these elements after second pass of the algorithm is:
Suppose we want to arrange the numbers stored in any array such that all negative values occur before all positive ones. Minimum number of exchanges required in the worst case is
A sorting technique is called stable if
The minimum number of record movements required to merge five files A (with records), B (with records), C (with records), D (with records) and E (with records) is:
What value would the following function return for the input ? Function fun (x:integer):integer; Begin If x > 100 then fun = x – 10 Else fun = fun(fun (x+11)) End;
Which one of the following algorithm design techniques is used in finding all pairs of shortest distances in a graph?
Give the correct matching for the following pairs: …
Let be the function defined by for . Which of the following statements is true?
The correct matching for the following pairs is …
Quick-sort is run on two inputs shown below to sort in ascending order taking first element as pivot Let and be the number of comparisons made for the inputs (i) and (ii) respectively. Then,
The average number of key comparisons required for a successful search for sequential search on items is
The recurrence relation has the solution equal to
Which of the following is false?
