Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Calculating distances in O(1)

Thread Tools

Calculating distances in O(1)

Gordon Burditt
Posts: n/a
>Let's look at another example:
>Atlanta to Houston: 790 mi
>Houseton to New York: 1610 mi
>New York to Norfolk: 370 mi
>By your logic, the distance between Atlanta to Norfolk would be 2770
>mi, while it is actually about 560 mi.

The first example may be correct, if you're talking about airline
miles rather than as-the-missile-flies distances.

>The problem you describe is usually solved by storing the position of
>each city, say the latitude and longitude, then calculating the
>distance between the two positions. This way all you need to do is
>look up the two positions and perform the distance calculation.

Unfortunately, it's not possible to GET a (nonstop) commercial
flight from Airport A to Airport B for all possible pairs of A and
B. Things such as the Wright Amendment make certain (commercial)
flights illegal, and others just don't have enough traffic to make
them worthwhile. Also, some airports may not be able to handle all
flights (an intercontinental flight from Paris, France to Northwest
Pothole, Texas may find the runways too short for anything but crop
dusters to land).

Gordon L. Burditt
Reply With Quote
Posts: n/a

Reply With Quote
Chuck F.
Posts: n/a
racygirl wrote:
> Whatever

I think you have been told enough times how to include proper
context even on the google interface, and you just ignore it. I
for one don't want to put up with these meaningless postings, so
goodbye. PLONK (which means your posts will never reach here in
the future).

"If you want to post a followup via, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <>
Reply With Quote
Default User
Posts: n/a
racygirl wrote:

> Whatever



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperfocal Distances Alan McGrath Digital Photography 5 06-05-2006 10:22 PM
Report, reduce the vertical distances tienlx ASP .Net 0 06-01-2006 07:13 AM
zip code and distances David Lozzi ASP .Net 6 06-23-2005 10:10 PM
converting a point known by 4 distances to xyz coordinates? Hul Tytus C Programming 1 02-16-2005 11:49 PM
dark photos at distances Bill Hilton Digital Photography 10 05-03-2004 05:43 PM