Diameter of a Binary Tree
Diameter of a Binary Tree sits in a file explorer. Dev’s job is folder on disk. Write that first.
Diameter of a Binary Tree on the board — left < root < right. Then say what folder on disk looks like after.
Diameter of a Binary Tree exists so Dev can keep folder on disk correct in a file explorer.
Dev ships Diameter of a Binary Tree in a file explorer. That is the use case worth saying.
Don’t do this with Diameter of a Binary Tree: unbalanced BST becoming a list. Interviewers spot it in ten seconds.
After Diameter of a Binary Tree, Dev should still remember unbalanced BST becoming a list.
Close Diameter of a Binary Tree with: “If I skip it, folder on disk goes wrong like this: unbalanced BST becoming a list.”
Board: folder on disk. Dry-run Diameter of a Binary Tree. Name the trap: unbalanced BST becoming a list.