Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!news.duesseldorf.ecrc.net!news.hamburg.ecrc.net!news.berlin.ecrc.net!news.ecrc.de!newsfeed.sunet.se!news00.sunet.se!sunic!news.sprintlink.net!news-peer.sprintlink.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: Really hard [Inform] problem
Message-ID: <erkyrathDzA9wB.BH0@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <326238DA.2D50@shef.ac.uk> <yxsu3rx38xv.fsf@stint.cl.cam.ac.uk> <53ts4g$j6h@nr1.calgary.istar.net>
Date: Mon, 14 Oct 1996 20:50:34 GMT
Lines: 43
Sender: erkyrath@netcom.netcom.com

Roger Carbol (rog@col.ca) wrote:
> Gareth Rees wrote:

> > The algorithm you need is called "single-source, shortest path", also
> > known as "Dijkstra's algorithm".  Here's one way to implement it, in
> > pseudo-code.

> [pseudo-code eaten by a grue]

> > Exercise: prove that the algorithm is correct.

> Sorry to be snide (it seems to be an occupational hazard in this newsgroup
> these days) but what do you really mean by "correct"?

> "Correct" as in it will always work, eventually?  "Correct" as in it's
> provably the "best" algorithm to use?  

When speaking of an algorithm, "correct" means that the algorithm fulfills
the problem it is intended to solve. If the problem is well-stated, this is
an objective property; you can mathematically prove the algorithm is
correct or incorrect. 

In this case, you have a graph, and the problem is to find the shortest 
path from a given node to every other node. See any graph theory book for 
a proof that Dijkstra's algorithm is correct.

(Correctness has nothing to do with whether the algorithm is fast, by the 
way. It so happens (I'm pretty sure) that Dijkstra's algorithm is as 
efficient as possible; that's a separate proof.)

> The reason I'm bringing it up (besides the opportunity to be snide) is that
> I think it might be a symptom of r.a.i-f (and I'm definitely including
> myself in this one) to think in terms of "correct" and "incorrect"

No, no; it's common terminology in computer science, and not emotionally 
loaded.

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
