[algogeeks] clearing n-stages of a game.

2013-05-04 Thread sreekanth guru
There n stages of a game. At each stage i you will come across a devil. Each devil has its own energy E(i) and price P(i). If you have energy X which is greater than the devils energy at that stage you can win over the devil without any energy loss or You just pay the price to devil then it will

Re: [algogeeks] max path

2013-05-04 Thread sreekanth guru
into Dijkstra's algorithm to find the minimum distance between the start and end points. (the weights would be negative of the points between two cells). On Mon, Apr 29, 2013 at 4:12 PM, sreekanth guru sreekanth.i...@gmail.comwrote: Problem: We have m * n grids. Each grid can have one

Re: [algogeeks] For a given set of points find a point along with 3 others that are closest to each other

2013-05-04 Thread sreekanth guru
// Repeat the following for n vertices. i = 1 to n. 1. construct the min heap with the distance from i to all other points. only with direct edges. If there is no direct edge make it infinite. 2. remove min edge(i, x) from heap. Now reheapify the min heap with x vertex direct edges. 3. repeat step

[algogeeks] max path

2013-05-02 Thread sreekanth guru
Problem: We have m * n grids. Each grid can have one of earth/water/mines. You can go to top/bottom/left/right adjacent grids. You can go to adjacent grids only when it is filled with earth/mines. you can't travers water filled grids. To travel to adjacent grid you need to sacrifice 2 points. If