## Marks 1

Consider the following C program.
#include < stdio.h >
int main () {
int a [4] [5] = {{1, 2, 3, 4, 5},
{6, 7, 8, ...

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. Wh...

A single array A[1..MAXSIZE] is used to implement two stacks, The two stacks grow from opposite ends of the array. Variables top1 and top2 (top1 < ...

An n $$\times$$ n array v is defined as follows V [i, j] = i - j for all i, j, $$1 \le i \le n,\,1 \le j \le n$$ The sum of the elements of the array ...

Suppose you are given an array s[1..n] and a procedure reverse (s, i, j) which reverse the order of elements in s between positions i and j (both incl...

## Marks 2

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 mini...

Define Rn to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For i > 0...

Consider the following C functions in which size is the number of elements in the array E:
int MyX(int *E, unsigned int size){
int Y = 0;
int Z;
in...

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 contiguo...

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 locations...

In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size n $$\tim...