Whenever you're ready, walk me through how you'd approach this.
How would you implement a decision tree algorithm?
Describe and implement a supervised decision tree for classification using tabular data. Your solution should explain impurity reduction, choose split thresholds, support recursive tree construction and prediction, and discuss stopping criteria, overfitting, pruning, computational complexity, and evaluation. Assume the input contains numerical features and a discrete target. Include handling for empty child nodes and unseen or invalid input values.