[algogeeks] Amazon Interview Question

2011-11-12 Thread Snoopy Me
Given a string consisting of a,b and c's, we can perform the following operation: Take any two adjacent distinct characters and replace it with the third character. For example, if 'a' and 'c' are adjacent, they can replaced with 'b'. What is the smallest string which can result by applying this

[algogeeks] Amazon Question

2011-11-12 Thread Snoopy Me
Given a string consisting of a,b and c's, we can perform the following operation: Take any two adjacent distinct characters and replace it with the third character. For example, if 'a' and 'c' are adjacent, they can replaced with 'b'. What is the smallest string which can result by applying this

[algogeeks] Amazon Question

2010-09-12 Thread Snoopy Me
You are given the amazon.com database which consists of names of millions of products. When a user enters a search query for particular object with the keyword say foo , output all the products which have names having 50% or more similarity with the given keyword ie foo Write the most efficient

[algogeeks] Re: BST

2010-07-26 Thread Snoopy Me
Hey could you please give a very brief on what is meant by threads in bst? On Jul 27, 5:17 am, Gene gene.ress...@gmail.com wrote: You don't thread the tree when you're ready to search it.  Rather you maintain the threads as it's built, which adds nothing to the asymptotic run time.  Parent

[algogeeks] Re: Adobe Puzzle

2010-07-19 Thread Snoopy Me
Nice way to put it erappy, here is another way. A block of length L can be place at the corner of the outer square such that it makes a triangle so that two sides of the triangle is the corner sides of the square and the base of the triangle is the block. Now, on this block another block can be

[algogeeks] Re: GIven 2 dates, print out the lines in the file between these 2 dates. Also optimize solution because the file may be huge and so dont go line by line.

2010-07-18 Thread Snoopy Me
At the time of logging, the timestamp can be added to a B-tree, with the nodes having the line number(i.e., number of bytes to be skipped from the beginning). At the time of searching, simple logarithmic time search will directly return the line address. On Jul 17, 11:27 pm, vijay