@w1024020103
2017-05-13T09:57:05.000000Z
字数 1017
阅读 1217
CS61B

BFS uses lots of memory for VERY WIDE GRAPH. One vertex connected to 1,000,000 vertices: because it puts lots of stuff on a queue.
DFS uses lots of memory for a spindly graph, because a giant
sequence of recursive in Java uses memory linear in # of recursive calls.


quiz:






Dijkstra's algorithm will find the shortest path from the source vertex to every other vertexes, this will waste a lot of memory in the specific situation:
Video:
Graphs: Dijkstra's Algorithm
Shortest Path using Dijkstra's Algorithm
dijkstras-shortest-path-algorith
自己试着做一遍:

we don't want to find the shortest path from vertex to every other vertex, but only want to find one target.

D(denver, NYC) = d(denver, v) + h(v):


当h(v)不正确的时候,会得不到正确的答案,这里把h(v)正确叫做:admissible.


