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
How many minimum spanning trees does the following graph have? Draw them. (Weights are assigned to edges).
A language with string manipulation facilities uses the following operations head(s): first character of a string tail(s): all but exclude the first character of a string concat(s1, s2): s1s2 For the string "" what will be the output of concat(head(s), head(tail(tail(s))))
Assume that and are non-zero positive integers. What does the following Pascal program segment do? while X <> Y do if X > Y then X := X - Y else Y := Y - X; write(X);
For merging two sorted lists of sizes and into a sorted list of size , we require comparisons of
In the following Pascal program segment, what is the value of X after the execution of the program segment? X := -10; Y := 20; If X > Y then if X < 0 then X := abs(X) else X := 2*X;
Merge sort uses:
Consider the following two functions: Which of the following is true?
Which of the following statements is false?
Algorithm design technique used in quicksort algorithm is?
The recurrence relation that arises in relation with the complexity of binary search is:
, where stands for order is:
What does the following code do? var a, b: integer; begin a:=a+b; b:=a-b; a:=a-b; end;
Which of the following problems is not -hard?
Following algorithm(s) can be used to sort in the range in time
Consider the following Pascal function: Function X(M:integer):integer; Var i:integer; Begin i := 0; while i*i < M do i:= i+1 X := i end The function call , if is positive, will return
Kruskal’s algorithm for finding a minimum spanning tree of a weighted graph with vertices and edges has the time complexity of:
The minimum number of comparisons required to sort elements is ______
The complexity of comparison based sorting algorithms is:
A language uses an alphabet of six letters, . The relative frequency of use of each letter of the alphabet in the language is as given below: …
A hash table with ten buckets with one slot per bucket is shown in the following figure. The symbols to initially entered using a hashing function with linear probing. The maximum number of comparisons needed in searching an item that is not present is
