Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #14338

Re: Problem C++ gas tank refuel

Path csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.programming
Subject Re: Problem C++ gas tank refuel
Date Wed, 15 Dec 2021 12:59:20 +0000
Organization A noiseless patient Spider
Lines 23
Message-ID <87lf0myqfr.fsf@bsb.me.uk> (permalink)
References <8fd306f3-1cdc-439b-a82c-458f9b926418n@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Injection-Info reader02.eternal-september.org; posting-host="5f596f9237df6631f4c71dc6171515d7"; logging-data="15316"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CA5RyTCK5HV9yx/rxtZO0uX8oWQeQT38="
Cancel-Lock sha1:MrWWd06HENsfqzR3KMGJ7aeqs6Y= sha1:NaamxywluGr1t4zjP3qyIbK4WDk=
X-BSB-Auth 1.654e4edc01d7beb165d5.20211215125920GMT.87lf0myqfr.fsf@bsb.me.uk
Xref csiph.com comp.programming:14338

Show key headers only | View raw


Darioes <darioes078@gmail.com> writes:

> Hi guys,
>
> Im programing a new exerciese that i need to do for a college project, in C++.
>
> 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.

That last phrase is a little confusing.  The stages that make up the
final route have costs, and the route with the minimum cost is to be
found.

Look up depth first search.  I would do this recursively.  Keep a note
of the least cost so far and update it every time the search reaches the
destination.  When a search exceeds the least cost so far, update it.
Lots of details remain for you to work out...

-- 
Ben.

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Problem C++ gas tank refuel Darioes <darioes078@gmail.com> - 2021-12-13 20:54 -0800
  Re: Problem C++ gas tank refuel Julio Di Egidio <julio@diegidio.name> - 2021-12-14 23:43 -0800
  Re: Problem C++ gas tank refuel Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-12-15 12:59 +0000
    Re: Problem C++ gas tank refuel Julio Di Egidio <julio@diegidio.name> - 2021-12-15 10:34 -0800
  Re: Problem C++ gas tank refuel Richard Heathfield <rjh@cpax.org.uk> - 2021-12-17 10:17 +0000
  Re: Problem C++ gas tank refuel Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-12-20 16:10 -0800
  Re: Problem C++ gas tank refuel Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-21 08:55 -0800

csiph-web