Tag Archives: Misc

A data structure is required for storing a set of integers such that each of the following operations can be done in (log n) time,… Read More
The best data structure to check whether an arithmetic expression has balanced parentheses is a (GATE CS 2004) (A) queue (B) stack (C) tree (D)… Read More
Suppose you are given an array s[1…n] and a procedure reverse (s,i,j) which reverses the order of elements in a between positions i and j… 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
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
The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is  (A) (n) … Read More
A set X can be represented by an array x[n] as follows:  Consider the following algorithm in which x,y and z are Boolean arrays of… Read More
Which of the following is not an in-place algorithm? (A) Insertion sort (B) Selection sort (C) Merge sort (D) Heap sort Answer: (C) Explanation: An… Read More
Which data structure is most efficient to find the top 10 largest items out of 1 million items stored in file? (A) Min heap (B)… Read More
In a village, people build houses in the same side of the road. A thief plans to loot the village. He wants maximum amount of… Read More
Given 8 identical coins out of which one coin is heavy and a pan balance. How many minimum number of measurements are needed to find… Read More
Which data structure is used in redo-undo feature? (A) Stack (B) Queue (C) Tree (D) Graph Answer: (A) Explanation: Stack data structure is most suitable… Read More
Which data structure is used for balancing of symbols? (A) Stack (B) Queue (C) Tree (D) Graph Answer: (A) Explanation: Stack is used for balancing… Read More
In a complete k-ary tree, every internal node has exactly k children. The number of leaves in such a tree with n internal nodes is: … Read More
The number of tokens in the following C statement is C printf(\"i = %d, &i = %x\", i, &i); (A) 3 (B) 26 (C) 10… Read More