Reprinted from: https://www.cnblogs.com/poppybloom/p/6809826.html
BFS and DFS
- BFS: This is a search method based on the data structure of a queue. Its characteristic is that each state can be expanded into many states, and then expanded until the target state is found or the head and tail pointers in the queue meet, that is, the queue All statuses in have been processed.
- DFS: A recursive search method, which is characterized by expanding from one state to another, and then continuously expanding until the target is found or the recursion of a state cannot be continued to expand.
Breadth First Search - BFS
Its idea is to start from a vertex V0 and traverse a wider area around it radially.
Suitable for maze type problems.
Link: http://blog.csdn.net/raphealguo/article/details/7523411
Depth First Search - DFS
http://blog.csdn.net/ns_code/article/details/19617187
Floyd-Warshall algorithm
The shortest path between any two points. Its time complexity is O(N3). It is also possible to find the shortest path between two specified points or the shortest path from a specified point to each of the remaining vertices.
For each node k, we check whether Dis(i,k) + Dis(k,j) < Dis(i,j) holds.
Link: http://developer.51cto.com/art/201403/433874.htm
Dijkstra's algorithm
is a typical single-source shortest path algorithm, which is used to calculate the shortest path from one node to all other nodes.
Dijksra's algorithm is a greedy algorithm with a time complexity of O(VLogV) (using a min-heap).
Link: http://www.cnblogs.com/biyeymyhjob/archive/2012/07/31/2615833.html
Bellman-Ford is used as a distance vector routing algorithm in network routing.
Bellman-Ford is also simpler than Dijkstra's algorithm and is also applicable to distributed systems. But the time complexity of Bellman-Ford is O(VE), E is the number of edges, which is slower than Dijkstra's algorithm.
spfa algorithm
The time complexity is O(ke), k is the average number of times the vertices enter the team, and k is generally less than or equal to 2
Link: http://www.360doc.com/content/13/1208/22/14357424_335569176.shtml
Minimum spanning tree problem
Kruskal algorithm, greedy algorithm;
Prim algorithm, which starts from a certain source point, maintains a set A (nodes in A constitute a tree), the algorithm selects an edge with the smallest weight from A to the nodes outside A each time, and then this The edges are added to set A.
http://blog.csdn.net/tostq/article/details/52733071
A* algorithm
A* Algorithm and BFS : It can be said that BFS is a special case of A* algorithm. For a BFS algorithm, each node expanded from the current node (if it has not been visited) is put into a queue for further expansion. That is to say, the estimation function h of BFS is always equal to 0. Without any heuristic information, it can be considered that BFS is the "worst" A* algorithm.
Link: http://www.cppblog.com/mythit/archive/2009/04/19/80492.aspx