开发者

A simple bus reservation system [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Can anybody describe me the logi开发者_StackOverflow社区c that i can use for bus reservation system. I am using MySql free edition. How can i put a facility where closest city name appears automatically to user.

Eg. If user searches bus from cityA to cityB and there are no buses between cityA and cityB. Then automatically, cityC which is closest to cityA and a bus which is there between cityC and cityB should appear?


This sounds like a case where you can use Dijkstra's algorithm to find the most efficient route.

Also, the database should not matter as it should be abstracted away rather than affecting the logic in your code.


Now that you have mentioned lat-long (missing in the question description), see this http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL


I guess you could have DB table with distances between cities and another with router between cities.

When a user inputs a query for a trip from A->B you can check whether you have A-> in table 2, and if not you select the closest city C for which you have C->B.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜