← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Interviewed for a data science role at Google, got asked a pretty foundational ML question about decision trees. Short and to the point, but I fumbled the explanation more than I expected to.

Questions Asked (1)

Q1

Can you explain how splitting works in a decision tree?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Thought I had this cold and then halfway through my answer I realized I was conflating information gain with Gini impurity without being clear about when you'd use one over the other.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining what a split is and why it's needed, then explain the mechanics of evaluating candidate splits using impurity measures, and finally discuss practical considerations like greedy algorithms and overfitting. Use a concrete example to illustrate the process.

Pro tip: Mention that decision trees use greedy, recursive partitioning, and that the choice of splitting criterion (e.g., Gini vs. entropy) often has little practical impact, but handling continuous features and missing values requires careful engineering.

1. Define the goal of splitting

Explain that splitting aims to partition data into subsets that are as homogeneous as possible with respect to the target variable, reducing impurity.

2. Describe impurity measures

Introduce common impurity metrics like Gini impurity, entropy (information gain), and variance reduction for regression, and how they quantify the quality of a split.

3. Explain the splitting algorithm

Outline the greedy search over features and thresholds (for continuous features) to find the split that maximizes impurity decrease, and mention that this is done recursively.

4. Discuss stopping criteria and pruning

Mention that splitting continues until a stopping condition (e.g., max depth, min samples) is met, and that pruning can combat overfitting.

5. Highlight practical considerations

Talk about computational complexity, handling categorical vs. continuous features, missing values, and the trade-offs between different splitting criteria.

Key Points to Mention

  • Greedy, recursive partitioning: at each node, choose the best split based on impurity decrease.
  • Impurity measures: Gini impurity, entropy (information gain), and variance reduction for regression.
  • Handling continuous features: sort values and consider midpoints between adjacent sorted values as candidate thresholds.
  • Stopping criteria: maximum depth, minimum samples per leaf, minimum impurity decrease, etc.
  • Pruning: post-pruning (e.g., cost-complexity pruning) to reduce overfitting.
  • Trade-offs: Gini vs. entropy, computational cost, and sensitivity to data scaling.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.