What is the order in which nodes of this tree are visited in depth-first order?

  • A: Z, =, Y, *, A, +, X
  • B: =, Z, +, *, X, Y, A
  • C: Y, A, *, X, Z, +, =
  • D: =, Z, +, *, Y, A, X
  • E: Z, Y, A, *, X, +, =

    Answer: D

    In depth-first order, a node is visited and then its children are visited in order (same as preorder).

    Contents    Page-10    Prev    Next    Page+10    Index