Question 61
What is the time complexity of predicting the class of a test sample using a standard Decision Tree of depth D?
Original solution basis:
Classification traverses down a single root-to-leaf path comparing 1 feature per node, taking O(D) operations where D is tree depth.
Deep Dive
A decision-tree prediction follows one path from the root to a leaf. At each node, it evaluates one split condition and chooses a child. If the maximum path depth is D, at most D such tests are performed, so prediction time is O(D), assuming each feature comparison is constant time.
Key Points to Remember:
• Prediction follows one root-to-leaf path, not every node.
• Time is O(D), where D is the depth.
• A balanced tree has depth around O(log N); a highly unbalanced tree may have depth O(N).
Exam tip:
Identify the governing definition or theorem first, write the formula, substitute the given values, and check dimensions/signs before selecting the option.