All pastes #205317 Raw Edit

Stuff

public text v1 · immutable
#205317 ·published 2006-10-16 18:46 UTC
rendered paste body
 1 .chk if given tree is bst ( they ask this where ever i go)

 2. given array with duplicates print the array in order of most occurances
lie 5 4 5 1 2 3 2 6 5 , op shd be 5 5 5 2 2 4 1 3 6

 3. they askd us assembly language prog  they gave an inst set
	 one accumulator , 2 regs

 find sum of first n natural numbers

4. code to allocate matrix of m x n

5. recursive sol to reverse linked list

6. given A and B how many bits must be toggled in A to get B

 7. Given (Sorted and not sorted )arrays A and B with duplicates ,creatre array C=A-B

8. given func  reverse(char arr[],i,j) that reverses substring frm i to j
   write a code to rorate array by n

---------------------------------------------

puzzles:
adobe:
A govt servant came to a maths prof house for a survey.he asked the 
prof abt the members of his family and their ages.The prof told his age 
and his wife's.he also told that he has 3 children.the product of their 
ages is 72 and the sum of their age is equal to his door number and his 
youngest child likes choclate pudding very much.
try to find the individual ages of the children with the info given.

---------------------

why do we use #if...def stuff like that
questions on data structures, linked lists and core maths(circle eqn. )....
and coordinate geometry....
recursion based question
binary-tree based question....very simple only
how do u move from one integer to another...no of bitflips required..

----------------------------------------





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.

-----------------------------------------