From: "Jeffrey R. Carter" <jrcarter@acm.org>
Subject: Re: Topological Sort Help
Date: Fri, 09 Feb 2007 04:57:56 GMT
Date: 2007-02-09T04:57:56+00:00 [thread overview]
Message-ID: <obTyh.263629$aJ.19483@attbi_s21> (raw)
In-Reply-To: <1170960817.632329.117990@v45g2000cwv.googlegroups.com>
isaac2004 wrote:
> an exit when makes no sense in this situation because there is no
> finite stopping condition, if you look at the algorithm provided, i
> see it harder top implement an exit when loop
>
> WHILE IsEmpty(G) /= False DO
This kind of construct generally indicates the coder doesn't understand
the concept of Booleans.
There's always an "exit when" equivalent to a while loop. Your loop is
equivalent to
while Isempty (G) loop
which is equivalent to
loop
exit when not Isempty (G);
Note that I'm not dealing with your algorithm here; I'm merely
suggesting that if you're having trouble with the condition for
continuing the loop, you might find it easier to think in terms of the
condition for exiting the loop.
--
Jeff Carter
"What I wouldn't give for a large sock with horse manure in it."
Annie Hall
42
next prev parent reply other threads:[~2007-02-09 4:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-04 19:54 Topological Sort Help isaac2004
2007-02-04 21:45 ` Ludovic Brenta
2007-02-05 20:30 ` isaac2004
2007-02-05 20:39 ` Ludovic Brenta
2007-02-06 2:18 ` isaac2004
2007-02-06 9:06 ` Ludovic Brenta
2007-02-08 1:19 ` isaac2004
2007-02-08 9:25 ` Ludovic Brenta
2007-02-08 18:14 ` isaac2004
2007-02-08 18:24 ` Ludovic Brenta
2007-02-08 18:29 ` isaac2004
2007-02-08 18:54 ` Ludovic Brenta
2007-02-08 19:14 ` isaac2004
2007-02-08 19:27 ` Ludovic Brenta
2007-02-08 20:22 ` isaac2004
2007-02-09 2:04 ` isaac2004
2007-02-08 18:38 ` Jeffrey R. Carter
2007-02-08 18:53 ` isaac2004
2007-02-09 4:57 ` Jeffrey R. Carter [this message]
2007-02-10 8:37 ` s053914
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox