array
GATE CSE & IT · Logical Reasoning - Puzzles · 1996-2025
Study anchor
Source-book anchor pending for this concept.
Practice action
Start latest PYQPYQs in this concept
All concepts →The pseudocode of a function fun () is given below: fun(int A[0,...,n-1]){ for i=0 to n-2 for j=0 to n-i-2 if (A[j]>A[j+1]) then swap A[j] and A[j+1] } Let A[0, ...,29] be an array...
#include int foo(int S[],int size) { if(size == 0) return 0; if(size == 1) return 1; if(S[0] != S[1]) return 1+foo(S+1,size-1); return foo(S+1,size-1); } int main() { int A[]={0,1,...
Consider an unordered list of $N$ distinct integers. What is the minimum number of element comparisons required to find an integer in the list that is NOT the largest in the list?
In the 4 x 4 array shown below, each cell of the first three rows has either a cross (X) or a number. 1 X 4 3 X 5 5 4 3 X 6 X The number in a cell represents the count of the immed...
An array [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified. Which one of the following options represents the first three elements in the heapified array?
Consider an array X that contains n positive integers. A subarray of X is defined to be a sequence of array locations with consecutive indices. The C code snippet given below has b...
Let P be an array containing n integers. Let t be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an a...
An unordered list contains $$n$$ distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum is
The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is ________
Let A be a square matrix size $$n \times n$$. Consider the following pseudocode. What is the expected output? C = 100; for i = 0 to n do for j = 1 to n do { Temp = A[ i ][ j ] + C...
An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the nu...
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 best algorithm to find all leaders in an array
A program P reads in 500 integers in the range [0, 100] representing the cores of 500 students. It then print the frequency of each score above 50. What would be the best way for P...
Consider the following statements: (i) First-in-first out types of computations are efficiently supported by STACKS. (ii) Implementing LISTS on linked lists is more efficient than...