Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.programming    |    Programming issues that transcend langua    |    57,431 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 55,468 of 57,431    |
|    Malcolm McLean to Darioes    |
|    Re: Problem C++ gas tank refuel    |
|    20 Dec 21 16:10:47    |
      From: malcolm.arthur.mclean@gmail.com              On Tuesday, 14 December 2021 at 04:54:49 UTC, Darioes wrote:       >        > That project consists in implementing an algorithm that just goes the       minimal ways, not like Dijkstra’s algorithm but something        > similar: You are have a car, that needs to go from France to Corea and you       need to refil your gas tank . You need to pick the minimal        > ways so that the car's fuel tank is as low as possible.        >        So the question is a bit different from the one anyone would expect. Instead       of minimising       fuel consumption, you are minimising the size of the fuel tank you need. So we       need the route       with the lowest maximum weight.              Richard Heathfield has suggested enumerating all paths, then taking the best.       This will work, and       what you should do as a first attempt. However it is O(N!) in complexity. So       it's only feasible for very        small networks.              To go faster, sort allthe edges by weight. Now clearly the path through the       maximum weight edge is       the worst. So eliminate it. Does a path from origin node to destination node       still exist? If so, eliminate       the next maximum weight edge. Repeat until eliminating an edge disconnects the       destination from       the origin. You must go through that edge, and that's your answer.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca