Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Basic tree traversal is considered "leetcode" these days? No wonder software is shit.


for html node selection? this seems like a silly jump


Exactly, how many times does anyone ever reach for binary traversal in their experience?

It’s optimising for the 1%.


Tree structures are very common in software. Needing to traverse them is also common. Sometimes people write utility functions to help you do it (that's where querySelector comes in), but it's really bad to think this knowledge is useless in writing software. You can't even list files recursively in a directory if you don't know how to properly do a tree traversal.

There are many algorithms in "leetcode" style questions that almost never get used in real world software development. Tree traversal is not one of them.

Heck, the whole family of lisp languages are nothing but "(non?)abstract syntax trees". Imagine getting reprimanded by a user named `morelisp` :)

And to be pedantic, since DOM trees are not binary trees, it's not a "binary traversal" problem. I encounter binary trees a lot less than the non-binary counterparts, but the traversal algorithm is basically the same.


Yeah, the first "binary traversal" I was willing to excuse as a typo.

By the second: Holy shit go read a book. Please.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: