Implemented BFS, DFS and A*
To compile this project, use the following command:
g++ -o search main.cpp
Then you can run it:
./search
The input is loaded from a input file in.txt
Here is the format of the input file:
The first line of the input file shoud contain two chars indicate the source and destination city for breadth first and depth first algorithm.
The second line of input file shoud be an integer m indicate the number of connections for the map.
Following m lines describe the map, each line represents to one connection in this form: dist city1 city2, which means there is a connection between city1 and city2 with the distance dist.
The following input are for A*
The following line contains two chars indicate the source and destination city for A* algorithm.
Then there is an integer h indicate the number of heuristic.
The following h lines is in the form: city dist which means the straight-line distance from the city to B is dist.
Ma tla b 是當(dāng)今使用最為廣泛的數(shù)學(xué)軟件,它具有相當(dāng)強(qiáng)大的數(shù)值計(jì)算、數(shù)據(jù)處理、系統(tǒng)
分析、圖形顯示、甚至符號(hào)運(yùn)算功能,是一個(gè)完整的數(shù)學(xué)平臺(tái),但是它不能實(shí)現(xiàn)端口操作和
實(shí)時(shí)控制Borland C + +Builder是一種新穎的可視化編程語言,可方便實(shí)現(xiàn)交互界面、數(shù)據(jù)
采集和端口操作等,但是它在數(shù)值處理分析和算法工具等方面,效率遠(yuǎn)遠(yuǎn)低于Matlab語言