[algogeeks] Re: servlet object creation

2010-11-14 Thread Amod
@Ayush 1. Container(Tomcat) calls default constructor of your servlet. Even if you have overloaded constructors still only default is called. 2. The container then calls init() method and passes servlet config object into it which contains properties local to a servlet defined in the web.xml. 3.

[algogeeks] Re: Brain Teaser

2010-11-11 Thread Amod
...@gmail.comwrote: 1 5 2 6 - - - - - - 3 7 4 8 On Thu, Nov 11, 2010 at 3:16 PM, Abhilasha jain mail2abhila...@gmail.com wrote: solution is 5 1 6 2 _ _ _ _ 7 3 8 4 On Thu, Nov 11, 2010 at 1:26 PM, Amod gam...@gmail.com wrote: We have a rectangle It is divided in eight parts

[algogeeks] Brain Teaser

2010-11-10 Thread Amod
We have a rectangle It is divided in eight parts by three vertical and one horizontal line so that there are 8 chambers. Now we have numbers from 1-8 to be filled in these chambers. Rule : No two consecutive numbers must be present either side to side or diagonal Invalid situation example Given 5

[algogeeks] Re: Least fare for a return trip Algorithm

2010-10-17 Thread Amod
1 7 8 3 6 9 1 9 10 6 6 12 I think we are not covering the point where index is reused. If we increment the index by one the the condition like 1 7 8 will not occur. Please suggest. Amod On Oct 16, 5:51 pm, Dave dave_and_da...@juno.com wrote: @Coolfrog$: 1. No. It should be O(n + k log k

[algogeeks] Re: Least fare for a return trip Algorithm

2010-10-13 Thread Amod
from the given arrays where we take one element from the first and one from second in the sum. Cheers Amod On Oct 13, 2:26 pm, Shiyam code_for_life mailshyamh...@gmail.com wrote: When a user wants to choose to fly from A to B, suggest the flight with lowest fare that's available, here its A1

[algogeeks] Least fare for a return trip Algorithm

2010-10-12 Thread Amod
Suppose there are 100 flights from A to B and 1000 flights from B to A. Now a user selects the round trip from A to B and back to A, the site presents suggestions based on the least fare of the return journey. Could someone please help me to device and algorithm where based on number of

[algogeeks] Re: Least fare for a return trip Algorithm

2010-10-12 Thread Amod
wanna have. if it's just the best deal, you can complete this in O(n+m) where n is the number of different fares of trip to and m is the trip back On Oct 12, 9:06 am, Amod gam...@gmail.com wrote: Suppose there are 100 flights from A to B and 1000 flights from B to A. Now a user