4 ms·
You're implying that someone who can't invent a BFS on the spot also doesn't know what tree traversal is. That's not true at all.
by 0xFACEFEED 8y ago
You're implying that someone who can't invent a BFS on the spot also doesn't know what tree traversal is. That's not true at all.
- calcifer 8y agoIf you can program [1], you can do BFS - no need to "invent" anything. Given a tree like this [2], asking you to "print the numbers in order" is not a difficult question, it's a trivial one. I would expect any interviewee that calls themselves a programmer to talk me through a reasonable answer to that question. Forget about what BFS means - you don't even need to know what a tree is. Looking at the image is all you need. [1] https://blog.codinghorror.com/why-cant-programmers-program/ https://blog.codinghorror.com/why-cant-programmers-program/ [2] https://upload.wikimedia.org/wikipedia/commons/3/33/Breadth-first-tree.svg https://upload.wikimedia.org/wikipedia/commons/3/33/Breadth-...