GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

Trees LC

Achuth Rajagopal Englisch 4 Karten

Karten in diesem Stapel (4)

  1. 1[LC102] Binary Tree Level Order TraversalAlgo:
    1 ) Form a queue and add the root, go till queue is not empty
    2 ) Get size of the queue, this will be the row, Add left and right if they exist.
    3 ) Finally pop the head of the queue add to the result row.
    4 ) Finally add the row to the list.
  2. 2[LC94] Binary Tree InOrder Traversal1 ) Have a stack (Common for all DFS).
    2 ) First push all till you hit the left corner.
    3 ) Then add left corner to the result.
    4 ) Check if right corner has a left, if yes continue to find new left corner.
    5 ) Else pop stack and continue.
  3. 3[LC144] Binary Tree PreOrder Traversal1 ) Simpler than the InOrder.
    2 ) First add top of stack.
    3 ) Add right and left to the stack. (*In that order.*)
    4 ) Repeat till stack is empty.
  4. 4[LC145] Binary Tree PostOrder Traversal

Informationen

Beschreibung
Trees list from LC
Erstellt von
Achuth Rajagopal
Aufrufe
1
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck