If asked in a technical interview, what technique or algorithm would you use to print the following values in sequential order?
output = 1, 2, 3, 4, 5, 6, 7
Hints
Often what makes tree-based questions difficult is knowing how to navigate their structure. Just like with working with standard Swift collections like a Dictionary, Array or Set, knowing how to navigate and manipulate content in trees unlocks their capabilities and allows us to apply them to specific situations.