Friday, July 31, 2009

Data structure issues

Problem 1: Reverse any message like "A cat goes here" to produce result like "here goes cat a".
Solution1: In First pass, use pointer from end, keep coming backwards and keep writing the characters. This leads to sth like "ereh seog tac A". Second Pass: reverse characters of each word to get result like "here goes cat a".

Problem2: HashMap vs ArrayList performance using Big-O notation.

Problem 3: How many number of bits are in an integer eg 7. Hint: use Bitwise operators of Java.

Problem 4: Given a log file, find which IPAddress appears max no of times in it.

River in South America

No comments: