Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - bfs dan dfs
Search - bfs dan dfs - List
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. -Implemented BFS, DFS and A* To compile this project, use the following command: g++-O search main.cppThen you can run it:./SearchThe input is loaded from a input file in.txtHere 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.
Date : 2025-07-12 Size : 3kb User : bo

该压缩文件中包含了图论当中的一些重要算法,包括前序中序和后序遍历、最小二叉树、DFS、BFS以及拓扑排序。-The compressed file contains a graph theory among a number of important algorithms, including the former order in the order and postorder traversal, the smallest binary tree, DFS, BFS, and topological sort.
Date : 2025-07-12 Size : 926kb User : 许娜娜
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.