Medium

Tree Traversal

Preorder visits a node before its children, inorder between them, and postorder after them. Each visits every node once.

Costs

CategoryAlgorithm
DifficultyMedium
TimeO(n)
Stack or recursionO(height)
Inorder on a BSTkeys come out sorted

Questions

What is Tree Traversal?

Preorder visits a node before its children, inorder between them, and postorder after them. Each visits every node once.

Where do I practice it?

DSA Master keeps challenges and progress on the phone. This page is the idea and the costs.