When using a breadth or depth first search algorithm in a tree search, how do you know which is better to use out of the two? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 14

When using a breadth or depth first search algorithm in a tree search, how do you know which is better to use out of the two?

Does it depend on the structure/width of the organised data tree?

10th Oct 2018, 11:31 PM
Sonic
Sonic - avatar
3 Answers
+ 5
It depends on your scenario. Typically both have more-or-less the same time complexity
10th Oct 2018, 11:38 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Breadth first search is more efficient... when compared to depth first search
11th Oct 2018, 1:55 PM
Nandhini Murugesan
Nandhini Murugesan - avatar
+ 2
You should look into big O notation. It gets into how to figure out how much time complexity certain algorithms have. MIT has a free corse on YouTube from 2011 I believe. I have currently been going through it and taking notes. Should be called MIT 6.006 on YouTube.
12th Oct 2018, 4:52 AM
Ryan
Ryan - avatar