here are some of the question in the interview...

1. How can u find 'k' shortest path in a graph....give an efficient solution...

paths are not dis-joint...

answer:

????????????????????????????????????????????????????????????????????????????????????????????

2. what strategy would u use to efficiently allocate process id to the processes...

2. what strategy would u use to efficiently allocate process id to the processes...

answer:

3. U r given with no from 1-81 divide them in 9 sets each containing equal no of numbers...such that sum of the nos in each set is equal...

You dont really need any LL / hash table for this. The OS would be allocating some sort of "Process Descriptor"; just return that. If a kernel mode stack is allocated return that; the advantage here is that you can get the PID of the currently running process (even on SMP architectures) by just reading ESX (the stack pointer )

3. U r given with no from 1-81 divide them in 9 sets each containing equal no of numbers...such that sum of the nos in each set is equal...

answer:

generic solution ..if n is odd

make n sets..placed in circle...

start with 1st...1...2nd 2........nth in n

whenever a mutliple of n is reached..start distributing next no. frm the set...whr last multiple of n was distributed....

continue like this...u wud get the required distribution....

ex. for n =5

1

2

3

4

5

next step

1,7

2,8

3.9

4,10

5,6

finally

1,7,13,19,25

2,8,14,20,21

3,9,15,16,22

4,10,11,17,23

5,6,12,18,24

make n sets..placed in circle...

start with 1st...1...2nd 2........nth in n

whenever a mutliple of n is reached..start distributing next no. frm the set...whr last multiple of n was distributed....

continue like this...u wud get the required distribution....

ex. for n =5

1

2

3

4

5

next step

1,7

2,8

3.9

4,10

5,6

finally

1,7,13,19,25

2,8,14,20,21

3,9,15,16,22

4,10,11,17,23

5,6,12,18,24

If 'm Wrong Please Correct It.

## No comments:

## Post a Comment

Note: Only a member of this blog may post a comment.