4 ms·
> > A recursive algorithm is a depth first search. Any loop that explores candidates/neighbors without sorting the candidates is a BFS. BFS is also a recursive
by hyperbrainer 2y ago
> > A recursive algorithm is a depth first search. Any loop that explores candidates/neighbors without sorting the candidates is a BFS.
BFS is also a recursive search. Even in the case of non-recursive search, the only difference is whether you use a queue or stack.
Apart from that, great article.
- fire_lake 2y agoAnd even then, execution depends on your language and compiler. Write a recursive BFS in Haskell and it won’t blow up the stack.
- hyperbrainer 2y agoAny language with decent TCO won't do that. Python is the only big language that I can think of that doesn't do it.
- fire_lake 2y agoGuaranteed TCO is pretty rare unfortunately. Java, Go, JavaScript all lack it.
- hyperbrainer 2y agoActually, you are right.