Sei sulla pagina 1di 1

1.) Tower of Hanoi prob. Given the no. of disks (n), find a general formula for the no.

of
moves required .
Now the restriction is that u cant directly move frm the source peg to destination peg.
Find the general formula now.

2.) Given a file with 107 numbers in the range 1 to 107 . Total RAM available is 1 MB.
How will you sort the numbers.

3.) Write code to dynamically allocate a 2 D and 3D array. What problem can come in
this allocation. Now modify this so that the entire allocated memory is contiguous.

4.) Pointer notation for a[i][j]

5.) A two dimensional array such that numbers in each row and column is in increasing
order. Search for a given number in the array.

6.) Design the game of chess.

7.) There are 8 characters and the probability of their occurrence is 1/2, 1/4, 1/8……
1/256. How will u represent it in binary using minimum no. of bits.

8.) There is an integer I and a function putchar(ch). How will u print the no. using this
function.

9.) Determine whether a number is a power of 2.

10.) Given a array of size M+N in which first M numbers are sorted and last N spaces are
vacant. Another array of size N which is sorted. Now merge these two arrays without
using any extra space so that the array of M+N size is sorted. Optimize it to hav
complexity M+N.

11.) 1,2,5,8, find all nos which can come next in the series. Now forget all the maths and
tell wat can be the sequence ahead comparing to some real world situation.

12.) Three containers of 15,10 and 6 ltrs capacity. Initially its in configuration (10,0,0).
Make it to configuration (0,8,5).

13.) An array of size N having nos in the range 0 to N-1 and can hav many duplicates
Find the duplicates.

Potrebbero piacerti anche