---
title: "Decision tree classifier and Hunt's algorithm"
subject: "Data Mining"
chapter: 3
key: "semester_7/data_mining:decision-tree-hunt"
source: https://www.bctengineer.com/q/semester_7/data_mining/decision-tree-hunt
site: BCT Engineering
---

# Decision tree classifier and Hunt's algorithm

Data Mining · Chapter 3: Classification

- Asked in: year not given
- Video: [Machine Learning | Hunt's Algorithm](https://www.youtube.com/watch?v=-kfOyPwGxww) — RANJI RAJ
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/data_mining/decision-tree-hunt
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-3

## Question

Describe Decision Tree Classifier with example. Explain Hunt's Algorithm.

## Short answer

A decision tree classifier recursively partitions data based on attribute tests, with leaves giving class labels. Hunt's algorithm: if all records at a node belong to one class, make it a leaf; otherwise, select the best attribute to split and recurse on child nodes.

## Answer

A **decision tree classifier** builds a tree-structured model: internal nodes test an attribute, branches are test outcomes, leaves give the class. To classify a record, the path from the root is followed according to its attribute values. It is built by recursive partitioning and can be turned into IF-THEN rules.

#### Example
Buys-computer data (14 tuples: 9 yes, 5 no) gives:

```text
            age?
       /     |       \
    young  middle   senior
      |      |         |
  student?  YES    credit_rating?
   /   \             /       \
  no   yes        fair    excellent
  NO   YES        YES        NO
```
A record (young, student = yes) reaches the leaf YES.

#### Hunt's algorithm
Hunt's algorithm is the basis of ID3, C4.5 and CART. It grows the tree recursively. Let Dₜ be the set of training records at node t and y = {y₁, y₂, …, y_c} the class labels.

1. If all records in Dₜ belong to the same class yₜ, then t is a **leaf** labelled yₜ.
2. If Dₜ is empty, t is a leaf labelled with the majority (default) class of its parent.
3. If Dₜ contains records of more than one class, select an **attribute test condition** to split Dₜ into smaller subsets, create a child node for each outcome, distribute the records, and apply the algorithm **recursively** to each child.

Additional rules are needed: if all records have identical attribute values but different classes (no split is possible), make a leaf with the majority class; and a best-split criterion (information gain, gain ratio or Gini index) is used to choose the test in step 3. The tree is grown in a greedy way, and pruning is done afterwards to avoid overfitting.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Hunt's algorithm is the basis of:
   A. K-means only
   B. Apriori
   C. ID3, C4.5 and CART
   D. Backpropagation
   Answer: C. It is the recursive framework of tree induction. (Key point: Hunt's base)

2. If all records in Dt belong to one class yt, then:
   A. t is split further
   B. t is deleted
   C. t gets the parent's class
   D. t is a leaf labelled yt
   Answer: D. Step 1 of Hunt. (Key point: Same class)

3. If Dt is empty, the node is:
   A. A leaf labelled with the parent's majority class
   B. Split on a random attribute
   C. Labelled with the root's class
   D. Removed with its parent
   Answer: A. Step 2. (Key point: Empty set)

4. If Dt has more than one class, Hunt's algorithm:
   A. Makes a leaf with the minority class
   B. Selects an attribute test, splits, and recurses on each child
   C. Stops immediately
   D. Merges with a sibling
   Answer: B. Step 3, using gain, gain ratio or Gini. (Key point: Mixed classes)

## Related in Data Mining

- [Decision tree advantages and disadvantages](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Adecision-tree-pros-cons) — Data Mining, chapter 3
- [Short note: Decision tree](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Adecision-tree-note) — Data Mining, chapter 3
- [Overfitting in ID3 and decision tree rules](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aid3-overfitting-rules) — Data Mining, chapter 3
- [Extracting rules from decision tree](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Arules-from-decision-tree) — Data Mining, chapter 3
- [Entropy, information gain and ID3 tree](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aid3-entropy-information-gain) — Data Mining, chapter 3
- [Buys computer: ID3 and Naive Bayes](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Abuys-computer-id3-naive-bayes) — Data Mining, chapter 3

## Related in other subjects

- [Explain decision tree analysis](https://www.bctengineer.com/question.md?key=semester_6%2Fengineering_economics%3Aexplain-decision-tree) — Engineering Economics, chapter 6, asked 5×
- [Decision tree for plant improvement alternatives](https://www.bctengineer.com/question.md?key=semester_6%2Fengineering_economics%3Adecision-tree-plant-alternatives) — Engineering Economics, chapter 6, asked 2×
- [Decision tree; infinite source blocking formulas](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Adecision-tree-infinite-sources) — Telecommunications, chapter 6, asked 2×
- [Decision tree; finite source blocking formulas](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Adecision-tree-finite-sources) — Telecommunications, chapter 6, asked 2×
