Two matrices M1 and M2 are to be stored in arrays A and B respectively. Each array can be stored either in row-major or column-major order in contiguous memory locations. The time complexity of an algorithm to compute M1 x M2 will be
GATE CSE · Programming In C
Practice problems for Array in Programming in C.
29 questions · 9 PYQs · 0 AI practice · GATE CSE 2027
Two matrices M1 and M2 are to be stored in arrays A and B respectively. Each array can be stored either in row-major or column-major order in contiguous memory locations. The time complexity of an algorithm to compute M1 x M2 will be
Consider the following declaration of a two-dimensional array in C : Char a[100][100] Assuming that the main memory is byte-addressable and that array is stored starting form memory address 0, the address of a [40] [50] is
Consider the following algorithm for searching for a given number x in an unsorted array A[1.....n] having n distinct values : (1) Choose an i uniformly at random from [1....n] (2) If A[i] = x then stop else Goto 1; Assuming that x is present A, What is the expected number of comparisons made by the algorithm before it terminates?
Suppose you are given an array s[1....n] and a procedure reverse (s, i, j) which reverses the order of elements in s between positions i and j (both inclusive). What does the following sequence do, where 1 n: reverse (s, 1, k); reverse (s, k+1, n); reverse (s, 1, n);
An array is defined as follows: for all The sum of the elements of the array is
Suppose we want to arrange the n numbers stored in any array such that all negative values occur before all positive ones. Minimum number of exchanges required in the worst case is
Let A be a two dimensional array declared as follows: A: array [1 ... 10] [1 ... 15] of integer; Assuming that each integer takes one memory location, the array is stored in row-major order and the first element of the array is stored at location 100, what is the address of the element A[i][j]?
The average number of key comparisons required for a successful search for sequential search on n items is
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size , non-zero elements, (i.e elements of lower triangle) of each row are stored one after another, starting from the first row, the index of the element of the lower triangular matrix in this new representation is:
Want unlimited AI-generated Array questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →