Level order and spiral order traversal of a binary tree in O(N)
Filed under Hike
The question
Write code to perform level order traversal of a binary tree, and modify the code to output the nodes in spiral/zigzag order, both with O(N) time complexity.
No write-up yet. Related questions below have one.
Related Hike questions
Collected from public candidate posts and coding forums. Updated Nov 2026.