[2016/7/11][dp][dfs]Flood Fill Algorithm(to find the shortest path)

来源:互联网 发布:python return 多个值 编辑:程序博客网 时间:2024/05/16 09:05

https://www.youtube.com/watch?v=Zwh-QNlsurI


从target开始,标记它为0.

4染色,如果上下左右某格子没有墙,就标记它为0+1.

以此类推,直至找到起点。

路径就是从起点开始走,每次选择四个方向里数字最小的,直至走到0.

0 0
原创粉丝点击