L9. Iterative Preorder Traversal in Binary Tree | C++ | Java | Stack

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

Find DSA, LLD, OOPs, Core Subjects, 1000+ Premium Questions company wise, Aptitude, SQL, AI doubt support and many other features that will help you to stay focussed inside one platform under one affordable subscription. Have a hassle free one stop solution for up-skilling and preparing.

Checkout the problem link 👇🏼
Iterative Preorder Traversal in Binary Tree

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

Hi, hope you are well.


Find DSA, LLD, OOPs, Core Subjects, 1000+ Premium Questions company wise, Aptitude, SQL and many other time saving features under one affordable subscription. Have a hassle free one stop solution for up-skilling and preparing yourself.


takeUforward
Автор

vector<int> A) {
stack<TreeNode*>st;
TreeNode*node =A;
vector<int>v;
while(!st.empty() || node != NULL){
if(node != NULL){
v.push_back(node->val);
st.push(node);
node = node->left;
}
else{
node = st.top();
st.pop();
node = node->right;
}
}
return v;
} //this is a nice stack approach . with more clean code.

rhishishranjan
Автор

Yesterday I gave my paytm interview and all the dsa questions asked were from the sde sheet. Moreover, the questions asked from the core subjects were from the core sheet. I was able to crack the interview with great ease all thanks to striver bhaiya OP. You are the best mentor in this world 🔥

AbhishekKumar-vrsh
Автор

watched a lot of videos for iterative traversal, but this one hit my brain in first attempt. Your explanation is great man

cursmrk
Автор

Was just able to code on my own. The way you give the intuition is just next level. Tysm Striver. Grateful to have a teacher like you.❤💯

aryanpinto
Автор

Please likeeee, shareeee and :) Also follow me at Insta: Striver_79

takeUforward
Автор

00:35 Iterative preorder traversal in binary tree
01:22 Iterative Preorder Traversal in Binary Tree is done using Stack
02:12 Iterative Preorder Traversal in Binary Tree using Stack
03:11 Iterative Preorder Traversal in Binary Tree using Stack
04:32 Importance of right side effects on mental strength
05:27 Iterative preorder traversal in binary tree is efficient and useful

tech_Personality
Автор

What, it means ---
Vector<int>preorder Traversal(Treenode* root )

abhishekanand
Автор

This Man Is a great example for those who say you can get a placement in Giant MNC's . Thanks Bhaiya You inspired me a lot

Codeology
Автор

i am thrilled at my transformation, i was able to write correct code before looking at your code! Tysm bhaiya😵♥️

shivangisrivastava
Автор

this is the best tree series till date, thanks a lot striver, would be really helpful if you could bring a playlist on dp on trees as well for both cp and interviews.

piyushsaxena
Автор

What an I wrote the C++ code by myself after watching the explanation part...

thegreekgoat
Автор

Started this tree series today and I don't know when I come up to the Lecture number 9. Such a wonderful explanation. Thanks you so much Sir for doing so much effort for us.😊

harshvardhanmishra
Автор

Striver is life saviour for tier-3 college guys like me. Thank you.

Ishan
Автор

UNDERSTOOD THANK YOU
May God Bless You❤

RachanaDatta
Автор

Sir your teaching style is really unique.

Manasidas
Автор

Hello Striver! I hope you're doing well :) Thank you so much for making these series that newbies like me can come back to again and again. The passion that you bring to teaching is infectious and in a sea of tutorial hell, your tutorials are a guiding light and the best path to follow! Really appreciate the effort that you put to help countless people. Your work is inspiring.

vasudhajha
Автор

Awesome explanation.... the iterative approach is also easy, but i found the recursion approach easier. Both approach are good, thanks for the explanation.

thebhagwabilla
Автор

This is the best channel I have come across on Data Structures/Coding. Thanks a lot!

vishalwaghmare
Автор

Very Nice way.
I used to write the preorder code using the inorder traversal with slight updation.

ayushagrawal
visit shbcf.ru