Skip to content
Gblog GeeksforGeeks True Geek Tournament – 7 Days Marathon to Earn the ‘True Geek’ Title!
Do you remember the childhood days, when cricket was the major reason for living to you and how excited you used to be for that… Read More
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is (GATE CS… Read More
Consider the following C function. float f(float x, int y)  {    float p, s; int i;    for (s=1, p=1, i=1; i < y; i ++) … Read More
The problem 3-SAT and 2-SAT are (A) both in P (B) both NP complete (C) NP-complete and in P respectively (D) undecidable and NP-complete respectively… Read More
Consider the following graph, Among the following sequences: (I) a b e g h f (II) a b f e h g (III) a b… Read More
Consider a weighted complete graph G on the vertex set {v1,v2 ,v} such that the weight of the edge (v,,v) is 2|i-j|. The weight of… Read More
An element in an array X is called a leader if it is greater than all elements to the right of it in X. The… Read More
A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. the root is… Read More
In a binary max heap containing n numbers, the smallest element can be found in time (GATE CS 2006) (A) 0(n) (B) O(logn) (C) 0(loglogn)… Read More
How many undirected graphs (not necessarily connected) can be constructed out of a given set V= {V 1, V 2,…V n} of n vertices ?… Read More
Consider an undirected unweighted graph G. Let a breadth-first traversal of G be done starting from a node r. Let d(r, u) and d(r, v)… Read More
Let G be an undirected graph. Consider a depth-first traversal of G, and let T be the resulting depth-first search tree. Let u be a… Read More
Let G be an undirected connected graph with distinct edge weight. Let emax be the edge with maximum weight and emin the edge with minimum… Read More
Consider the following functions Which of the following is true? (GATE CS 2000) (a) h(n) is 0(f(n)) (b) h(n) is 0(g(n)) (c) g(n) is not… Read More
Let S be a stack of size n >= 1. Starting with the empty stack, suppose we push the first n natural numbers in sequence,… Read More
Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree.… Read More