Binary Tree Preorder Traversal (Iterative) - Leetcode 144 - Python

preview_player
Показать описание


0:00 - Read the problem
0:50 - Drawing Explanation
7:20 - Coding Explanation

leetcode 144

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

For me I think I prefer to append right and left to the stack and just loop while the stack is non-empty, starting by placing the root in the stack before the while loop. Makes it a very clean solution.

victoriatfarrell
Автор

I have never thought of the call stack in this way before... great video

cyclone
Автор

hi
Why did you decide to open a new channel?
Where should we expect new videos?

alexandersmirnov
Автор

Thank you so much for the explanation.
But why the time complexity will be O(log n) if the tree was a balanced binary tree?

saraahmed
join shbcf.ru