广度优先算法·体会
之前我写过了两篇关于广度优先搜索的文章,现在对它可是深有体会了。
l wrote two dialogues about BFS,now l learn a lot about it.
简单来说,广度优先搜索就是不进则退。
To easy,BFS is forward or back.
结合之前的题,广度优先搜索有一个致命的弱点。
Combining previous questions, breadth-first search has a fatal weakness.
就是时间和空间复杂度高。
That is O( ) is high.
但他有一个人见人爱的优点。
But it has one succseness everyone loves.
那就是代码简单。
That is its code is easily.
他有两种解决的方法:
It has two ways over the coding:
顺推和逆推。
forward way and back way.
一个从起点,一个从终点。
One is from the begain and another is from the end.
不管什么同类型的题,基本思路都一样。
No matter what kind of questions, the basic ideas are the same.
重要的不是代码,而是思路。
The important isn’t the code,is the idea.