🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Tree Traversals: all 13 questions

Quiz: Tree Traversals · Question 6 of 13

In iterative preorder with a stack, why is the right child pushed before the left?

In iterative preorder with a stack, why is the right child pushed before the left?

  1. A.So the left child is popped (and visited) first
  2. B.To visit the right subtree first
  3. C.Because stacks cannot hold left children
  4. D.It makes no difference
Answer & explanation

Correct answer: So the left child is popped (and visited) first

A stack is last-in, first-out: pushing left last means it comes out first.

Can you get the rest right without peeking?

Take the timed Quiz: Tree Traversals quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →