[algogeeks] Re: Google Interview Question: find shortest summary containing all key words

2007-10-05 Thread Shrenik
reposting since it didn't appear yesterday, apologies A small variation of Vishal's algorithm to eliminate the need of the bitmap. I use a hash table of integers index by the keyword, initialized to all 0. I also make use of the property that in the shortest summary the first and the last

[algogeeks] Re: Programing problem

2007-10-05 Thread adak
For each test case Do call function Read_it() /* read the next move */ call Count_it() /* count the # of squares walked through */ while (move length is 0) print area moved through for that case next That would be my starting pseudo-code.

[algogeeks] Re: Programing problem

2007-10-05 Thread Vishal
Find the enclosing rectangle for the area. Calculate minX, maxX, minY, maxY. Now find whether the enclosing area lies to left and right side of the path**. Note that the path is not self-intersecting. currX = startX; area = 0 if ( left ) // enclosing area to left of path { for each move {