Timeline for How do I traverse a tree without using recursion?
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 3, 2019 at 13:56 | vote | accept | Reactgular | ||
| Jan 19, 2015 at 9:24 | comment | added | Anders Arpi | FYI I think this is the correct answer most people googling this question are looking for. +1 | |
| Jan 30, 2014 at 22:27 | comment | added | Reactgular | Thanks @KarlBielefeldt said it better than I could. Each node has to receive the output from it's children. | |
| Jan 30, 2014 at 22:22 | comment | added | Karl Bielefeldt | He's not just traversing the graph performing independent operations like a search, he's aggregating the data from the child nodes. Flattening the tree destroys the structure information he needs in order to perform the aggregation. | |
| Jan 30, 2014 at 21:59 | comment | added | Servy | @MathewFoscarini How so? You can just foreach over the sequence and perform some operation on each item in the sequence, as your code appears to be doing. | |
| Jan 30, 2014 at 21:58 | comment | added | Reactgular | I don't think that solves the problem. | |
| Jan 30, 2014 at 21:56 | comment | added | Servy | @MathewFoscarini Yes, that's its purpose. Of course, it doesn't need to necessarily be materialized into an actual collection. It's just a sequence. You can iterate over it to stream the data, without needing to pull the entire data set into memory. | |
| Jan 30, 2014 at 21:56 | comment | added | Reactgular | Am I correct in thinking this will just flatten the tree into a collection? | |
| Jan 30, 2014 at 21:49 | history | edited | Servy | CC BY-SA 3.0 | added 122 characters in body |
| Jan 30, 2014 at 21:43 | history | answered | Servy | CC BY-SA 3.0 |