[algogeeks] Re: Google-Puzzle

2012-02-25 Thread karthikeya s
buddy i said that kadane's algo(max subsum) wouldn't work..

On Feb 25, 1:31 pm, Ashish Goel ashg...@gmail.com wrote:
 max subsum problem
 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

 On Sat, Feb 25, 2012 at 1:03 PM, karthikeya s 
 karthikeya.a...@gmail.comwrote:







  You have a circular track containing fuel pits at irregular intervals.
  The total amount of fuel available from all the pits together is just
  sufficient to travel round the track and finish where you started.
  Given the the circuit perimeter, list of each fuel pit location and
  the amount of fuel they contain, find the optimal start point on the
  track such that you never run out of fuel and complete circuit.

  my logic:
  we can use an array having element as
  fuel(in km)-dist to next pit

  so now aim is to traverse the array as always having some +ve
  resultant sum.nd plz we cant use here kadane's algo.there are
  cases in which it will not hold here

  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Google-Puzzle

2012-02-25 Thread Ashish Goel
it will

the diff is of fuel and dist forms the content of array which moves from 1
to 2n-1 elements(break the circle and instead of elem like 1,2,n have
1,2,n,1,2,...n-1
i.e. total 2n-1 so that mod stuff is not required.

now find maxsubSum such that sum=0 and count of nodes is n

not clear ehy it wont work.
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Sat, Feb 25, 2012 at 2:54 PM, karthikeya s karthikeya.a...@gmail.comwrote:

 buddy i said that kadane's algo(max subsum) wouldn't work..

 On Feb 25, 1:31 pm, Ashish Goel ashg...@gmail.com wrote:
  max subsum problem
  Best Regards
  Ashish Goel
  Think positive and find fuel in failure
  +919985813081
  +919966006652
 
  On Sat, Feb 25, 2012 at 1:03 PM, karthikeya s karthikeya.a...@gmail.com
 wrote:
 
 
 
 
 
 
 
   You have a circular track containing fuel pits at irregular intervals.
   The total amount of fuel available from all the pits together is just
   sufficient to travel round the track and finish where you started.
   Given the the circuit perimeter, list of each fuel pit location and
   the amount of fuel they contain, find the optimal start point on the
   track such that you never run out of fuel and complete circuit.
 
   my logic:
   we can use an array having element as
   fuel(in km)-dist to next pit
 
   so now aim is to traverse the array as always having some +ve
   resultant sum.nd plz we cant use here kadane's algo.there are
   cases in which it will not hold here
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.