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

I've never really thought about how all the common ways we serialise trees in text (JSON, s-expressions, even things like tables of content, etc), serialise them depth-first.

I suppose it's because doing it breadth-first means you need to come up with a way to reference items that will arrive many lines later, whereas you don't have that need with depth-first serialisation.



Also it makes memory allocation easier




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

Search: