Write an iterative function to reverse a string. Do the same thing as a recursive function.
Java Google Interview Questions
Explain final, finalize() and finally?
Explain the difference between a mutex and a semaphore? If you need to protect access to an increment operation which one would be the best choice?
If you have access to a function that returns a random integer from one to five, write another function which returns a random integer from one to seven.
Discuss an algorithm to traverse a tree, depth first.
Describe a schema (or classes) to power an online car rental system. Describe the tables and the relationships beween the tables.
Construct a regular expression that matches a valid email address.
Implement a function with signature find_chars(string1, string2) that takes two strings and returns a string that contains only the characters found in string1 and string two in the order that they are found in string1. Implement a version of order N*N and one of order N.
Explain what a deadlock is in multithreaded programming
Given a circular list of integers (when you reach the end of the list you come back to the beginning), what is the most efficient algorithm to find the smallest integer in the list?
circular_list = [22, 52, 66, 82, 5, 8, 12, 19].
Explain the terms static, final, and const
Given a N by N matrix of both negative and positive integers. Write an efficient algorithm to find the sub-matrix with the largest sum of all the contained elements.
Implement a function to divide two integers without using the divide operator.
Design a system to efficiently calculate the top 1MM Google search queries and create a report of these. Additionally:
- You are given twelve servers
- Each has two processors, 4GB of ram and four 400GB hard drives.
- The machines are networked
- The log data as roughly 100 Billion log lines in it.
- The log data comes in twelve, 320 Gb files.
- Each line of the files has roughly 40 search queries
- You can only use open source software or software that you write.
Given an array A[N] containing N numbers. Crate an array Output[N] where Output[i] is equal to the product of all the elements of A[N] except A[i].
For example Output is the product of A to A[N-1] and Output is the product of A and from A to A[N-1].
Do this without using the division operator. Do it in O(n).
You are given a linked list of integers of length N.
N is very large and you don’t know N.
Write a function to return k completely random numbers from the list.
Do this in O(n).
Hint: Use random function rand() (returns a number between 0 and 1) and irand() (return either 0 or 1) 2.
Write a function to efficiently determine the result of a game of Tic Tac Toe.
The function takes as input the game and the sign (x or o) of the player. The function returns if this player has won the game or not.
Carefully consider both the data structure and the algorithm for your answer.
Write a function to efficiently find the fifth maximum element in a binary search tree. Try to do this without using significant additional storage.
Design the schema or the classes to implement a library for building card games with. This library should make it easy to build games like Rummy, Poker, Hearts, Whist etc.
Outline the implementation for two of the most important methods of the