Inorder (LNR)
Visit left subtree, root, right subtree. On a BST yields sorted ascending order. Used for BST validation and kth smallest.
def inorder(node):
if not node: return
inorder(node.left)
visit(node)
inorder(node.right)
DSA · 9 sections
Traversal, BST operations, balanced trees, trie, segment tree, Fenwick tree, and the tree patterns behind half of all DSA interviews.
Visit left subtree, root, right subtree. On a BST yields sorted ascending order. Used for BST validation and kth smallest.
def inorder(node):
if not node: return
inorder(node.left)
visit(node)
inorder(node.right)
Visit root, left, right. Used to serialize/copy a tree and to build from preorder+inorder. Root comes first.
def preorder(node):
if not node: return
visit(node)
preorder(node.left)
preorder(node.right)
Visit left, right, root. Used to delete a tree, compute subtree aggregates, and evaluate expression trees. Children processed before parent.
def postorder(node):
if not node: return
postorder(node.left)
postorder(node.right)
visit(node)
128 more cards in this sheet
Unlock the DSA & Data Structures bundle — ₹399
One-time payment. Unlocks this sheet and 8 other sheets in the bundle, plus a typeset PDF of each.
Unlock the bundle See all bundles
Or get all 76 sheets for ₹999 — one payment, every future sheet included.
What's new and the interview questions people are actually getting asked. No spam.