Asymptotic Notation: GATE CS Previous Year Questions

Asymptotic Notation · Algorithms

40 questions · asked in 21 of 27 years (2000–2026)

MCQ 37 · MSQ 2 · NAT 11-mark 27 · 2-mark 13

2000Questions per year2026

Questions 11–15 of 40

Q11GATE 2017 (Session 2)2 marksMCQ−0.67 if wrong
Consider the following C function

int fun (int n) {
  int i, j;
  for (i = 1; i <= n; i++) {
      for (j = 1 ; j < n ; j+=i) {
          printf ("%d %d ", i, j);
          }
     }
}
The time complexity of fun in terms of θ\theta notation is

Q12GATE 2016 (Session 1)2 marksMCQ−0.67 if wrong
Consider a carry lookahead adder for adding two n-bit integers,built using gates of fan-in at most two. The time to perform addition using this adder is

Q13GATE 2016 (Session 2)2 marksNAT
The given diagram shows the flowchart for a recursive function A(n). Assume that all statements, except for the recursive calls, have O(1) time complexity. If the worst case time complexity of this function is O(nα)O(n^{\alpha }), then the least possible value (accurate upto two decimal positions) of α\alpha is .
Start A(n/2) A(n/2) Return A(n/2) A(n/2) Return A(n/2) Return A(n/2) Return

Q14GATE 2016 (Session 2)2 marksMCQ−0.67 if wrong
In an adjacency list representation of an undirected simple graph G = (V,E), each edge (u,v) has two adjacency list entries: [v] in the adjacency list of u, and [u] in the adjacency list of v. These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If |E|=m and |V|=n, and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the twin pointer in each entry in each adjacency list?

Q15GATE 2015 (Session 1)2 marksMCQ−0.67 if wrong
Consider the following C function.
int fun1(int n){
    int i,j,k,p,q=0;
    for (i=1; i < n; ++i) {
        p=0;
        for (j=n; j > 1; j=j/2)
              ++p;
        for (k=1; k < p; k=k*2) 
             ++q;
        }
    return q;
} 
Which one of the following most closely approximates the return value of the function fun1?

Keep practising

Topics in Algorithms

All CS topics ›