What is the time complexity of making a single prediction with a decision tree of depth H?

Quick Overview

Asks for the time complexity of one prediction with a decision tree of a given depth. It tests whether you can count the work along a root-to-leaf path, relate tree depth to the number of training rows for balanced and degenerate trees, and extend the reasoning to tree ensembles.

What is the time complexity of making a single prediction with a decision tree of depth H?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What is the time complexity of making a single prediction with a decision tree of depth `H`? ```hint Follow one sample Trace the path a single sample takes from the root. Count how many nodes it visits and how much work each visit costs. ``` ### What a Strong Answer Covers - The cost of one internal node and the number of nodes a sample visits - How depth relates to the number of training samples in balanced and degenerate trees - What changes for ensembles and for splits that test more than one feature - How prediction cost compares with training cost ### Follow-up Questions - How would you bound the depth in practice, and what does that cost in accuracy? - Why can two trees of the same depth have very different real prediction latency? - What is the prediction cost of a gradient-boosted model with 1,000 trees, and how would you make it faster?

Overview: Asks for the time complexity of one prediction with a decision tree of a given depth. It tests whether you can count the work along a root-to-leaf path, relate tree depth to the number of training rows for balanced and degenerate trees, and extend the reasoning to tree ensembles.

General logo
General
Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

What is the time complexity of making a single prediction with a decision tree of depth H?

What a Strong Answer Covers Guidance

  • The cost of one internal node and the number of nodes a sample visits
  • How depth relates to the number of training samples in balanced and degenerate trees
  • What changes for ensembles and for splits that test more than one feature
  • How prediction cost compares with training cost

Follow-up Questions Guidance

  • How would you bound the depth in practice, and what does that cost in accuracy?
  • Why can two trees of the same depth have very different real prediction latency?
  • What is the prediction cost of a gradient-boosted model with 1,000 trees, and how would you make it faster?