Coding Interview Tutorial 16: Binary Tree Zigzag Level Order Traversal [LeetCode]

preview_player
Показать описание
Learn how to traverse a binary tree in zigzag level order.

This is an important programming interview question, and we use the LeetCode platform to solve this problem.

Рекомендации по теме
Комментарии
Автор

Instead of using two stacks, you can also use a single queue by conducting regular level order traversal and reversing the corresponding values of each level if a boolean flag is true. This flag should be toggled between cycles.

midasama
Автор

I didn't understand deep copy part. Can you please explain that a bit more?

ketulshah
Автор

what is the time complexity of this Algo. I don't think this is the most optimal way to solve this

Vaasu
welcome to shbcf.ru