Home Company Questions Microsoft Interview Questions Microsoft Interview Questions - 10

Login Form




Microsoft Interview Questions - 10 Print E-mail

1. Given an infinite stream of bits with the bits being appended at the highest significant position. give an algorithm to to say whether the number formed by using the sequence of bits that had been processed till then, is divisible by 3 or not?

 

2. Write a function to find the depth of a binary tree.

 

3. Implement an algorithm to reverse a linked list. Now do it without recursion.

 

4. What's the difference between a linked list and an array?

 

5. Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

 

6. Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like.

 

7. Write a C code to merge 2 binary search trees and do the same 2 merge linked lists.How is the former different when compared to the later. (Discuss the issues)

 

8. Given a Parent -Child binary tree ,build the child -sibling version of it? Minimize the space requirements wherever possible.

 

9. Describe advantages and disadvantages of the various stock sorting algorithms.

 

10. Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of the array only once. Describe an algorithm to find the repeated number. If you used auxiliary storage in your algorithm, can you find an algorithm that does not require it?

 

11. Give a very good method to count the number of ones in a "n" (e.g. 32) bit number

 

12. Given a string S of alphabets and 2 characters a,b find the minimum distance between instances of them such that position of a <= position of b.

 

13. Given a binary tree build a linked list of all its nodes such that the nodes of a level appear before the nodes of the next level?

 

14. Implement an algorithm to sort a linked list. Why did you pick the method you did? Now do it in O(n) time.

 

15. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) ). Write a routine in C for the above.