Home Company Questions Google Interview Questions Google Interview Questions - 6

Login Form




Google Interview Questions - 6 Print E-mail

1. You are given an array [a1 To an] and we have to construct another array [b1 To bn] where bi = a1*a2*...*an/ai. you are allowed to use only constant space and the time complexity is O(n). No divisions are allowed.

 

2. Given two sequences of items, find the items whose absolute number increases or decreases the most when comparing one sequence with the other by reading the sequence only once.

 

3. Write a program for displaying the ten most frequent words in a file such that your program should be efficient in all complexity measures.

 

4. Implement put/get methods of a fixed size cache with LRU replacement algorithm.

 

5. Given a file of 4 billion 32-bit integers, how to find one that appears at least twice?

 

6. Find or determine non existence of a number in a sorted list of N numbers where the numbers range over M, M >> N and N large enough to span multiple disks. Algorithm to beat O(log n) bonus points for constant time algorithm.

 

7. How do you find out the fifth maximum element in an Binary Search Tree in efficient manner.

Note :: You should not use use any extra space. i.e sorting Binary Search Tree and storing the results in an array and listing out the fifth element.

 

8. Given that you have one string of length N and M small strings of length L . How do you efficiently find the occurrence of each small string in the larger one ?

 

9. Design a stack. We want to push, pop, and also, retrieve the minimum element in constant time.

 

10. Given two binary trees, write a compare function to check if they are equal or not. Being equal means that they have the same value and same structure.