Cracking the Code -- Recursive Tree + Graph answers
I'm reading through cracking the code and I noticed that all of the Tree and Graph coding challenges were answered recursively. I was wondering why, and what is the advantage of doing this? I was under the assumption that recursive answers for Trees and Graphs was a bad idea due to stack overflows. Similarly, do you guys generally answer Tree and Graph related questions in a recursive fashion during interviews?
Open Chat in New Window