ArticleslgStudy

computer science

Decision tree model

Decision tree model is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Decision tree model rather than just read about it. In short: In computational complexity theory, the decision tree model is the model of computation in which an algorithm can be considered to be a decision tree, i.e. a sequence of queries or tests that are done adaptively, so the outcome of previous tests can influence the tests performed next. Typically, these tests have a small number of outcomes (such as a yes–no question) and can be performed quickly (say, with unit compu…

Decision tree model — main illustration
Decision tree model — illustration

Key takeaways

  • Decision tree model belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Decision tree model to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Decision tree model from memory before moving on to harder problems.

Reference excerpt

In computational complexity theory, the decision tree model is the model of computation in which an algorithm can be considered to be a decision tree, i.e. a sequence of queries or tests that are done adaptively, so the outcome of previous tests can influence the tests performed next. Typically, these tests have a small number of outcomes (such as a yes–no question) and can be performed quickly (say, with unit computational cost), so the worst-case time complexity of an algorithm in the decision tree model corresponds to the depth of the corresponding tree. This notion of computational complexity of a problem or an algorithm in the decision tree model is called its decision tree complexity or query complexity. Decision tree models are instrumental in establishing lower bounds for the complexity of certain classes of computational problems and algorithms. Several variants of decision tree models have been introduced, depending on the computational model and type of query algorithms are allowed to perform. For example, a decision tree argument is used to show that a comparison sort of n items must make nlog⁡(n) comparisons. For comparison sorts, a query is a comparison of two items a,b, with two outcomes (assuming no items are equal): either a<b or a>b. Comparison sorts can be expressed as decision trees in this model, since such sorting algorithms only perform these types of queries.

Comparison trees and lower bounds for sorting Decision trees are often employed to understand algorithms for sorting and other similar problems; this was first done by Ford and Johnson. For example, many sorting algorithms are comparison sorts, which means that they only gain information about an input sequence x1,x2,…,xn via local comparisons: testing whether xi<xj, xi=xj, or xi>xj. Assuming that the items to be sorted are all distinct and comparable, this can be rephrased as a yes-or-no question: is xi>xj? These algorithms can be modeled as binary decision trees, where the queries are comparisons: an internal node corresponds to a query, and the node's children correspond to the next query when the answer to the question is yes or no. For leaf nodes, the output corresponds to a permutation π that describes how the input sequence was scrambled from the fully ordered list of items. (The inverse of this permutation, π−1, re-orders the input sequence.) One can show that comparison sorts must use Ω(nlog⁡(n)) comparisons through a simple argument: for an algorithm to be correct, it must be able to output every possible permutation of n elements; otherwise, the algorithm would fail for that particular permutation as input. So, its corresponding decision tree must have at least as many leaves as permutations: n! leaves. Any binary tree with at least n! leaves has depth at least log2(n!)=Ω(nlog2(n)), so this is a lower bound on the run time of a comparison sorting algorithm. In this case, the existence of numerous comparison-sorting algorithms having this time complexity, such as mergesort and heapsort, demonstrates that the bound is tight. This argument does not use anything about the type of query, so it in fact proves a lower bound for any sorting algorithm that can be modeled as a binary decision tree. In essence, this is a rephrasing of the information-theoretic argument that a correct sorting algorithm must learn at least log2(n!) bits of information about the input sequence. As a result, this also works for randomized decision trees as well. Other decision tree lower bounds do use that the query is a comparison. For example, consider the task of only using comparisons to find the smallest number among n numbers. Before the smallest number can be determined, every number except the smallest must "lose" (compare greater) in at least one comparison. So, it takes at least n−1 comparisons to find the minimum. (The information-theoretic argument here only gives a lower bound of log⁡(n).) A similar argument works for general lower bounds for computing order statistics.

Linear and algebraic decision trees Linear decision trees generalize the above comparison decision trees to computing functions that take real vectors x∈ℝn as input. The tests in linear decision trees are linear functions: for a particular choice of real numbers a0,…,an, output the sign of a0+∑i=1naixi. (Algorithms in this model can only depend on the sign of the output.) Comparison trees are linear decision trees, because the comparison between xi and xj corresponds to the linear function xi−xj. From its definition, linear decision trees can only specify functions f whose fibers can be constructed by taking unions and intersections of half-spaces. Algebraic decision trees are a generalization of linear decision trees that allow the test functions to be polynomials of degree d. Geometrically, the space is divided into semialgebraic sets (a generalization of a hyperplane). These decision tree models, defined by Rabin and Reingold, are often used for proving lower bounds in computational geometry. For example, Ben-Or showed that element uniqueness (the task of computing f:ℝn→{0,1}, where f(x) is 0 if and only if there exist distinct coordinates i,j such that xi=xj) requires an algebraic decision tree of depth Ω(nlog⁡(n)). This was first shown for linear decision models by Dobkin and Lipton. They also show a n2 lower bound for linear decision trees on the knapsack problem, generalized to algebraic decision trees by Steele and Yao.

Boolean decision tree complexities For Boolean decision trees, the task is to compute the value of an n-bit Boolean function f:{0,1}n→{0,1} for an input x∈{0,1}n. The queries correspond to reading a bit of the input, xi, and the output is f(x). Each query may be dependent on previous queries. There are many types of computational models using decision trees that could be considered, admitting multiple complexity notions, called complexity measures.

Deterministic decision tree If the output of a decision tree is f(x), for all x∈{0,1}n, the decision tree is said to "compute" f. The depth of a tree is the maximum number of queries that can happen before a leaf is reached and a result obtained. D(f), the deterministic decision tree complexity of f is the smallest depth among all deterministic decision trees that compute f.

… excerpt ends here. Continue reading the full article.

Illustrations

Decision tree model: Decision Tree Model
Decision Tree Model

Worked examples

Example 1 — a first encounter with Decision tree model

Start with the simplest possible case. Write down what Decision tree model claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Decision tree model before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Decision tree model ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Decision tree model

In research
Decision tree model appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Decision tree model in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Decision tree model is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational complexity theory, Decision trees, Models of computation, so understanding it makes those chapters shorter.
In everyday life
Look for Decision tree model outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Decision tree model” →

How to study Decision tree model in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Decision tree model means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Decision tree model out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Decision tree model in simple terms?

In computational complexity theory, the decision tree model is the model of computation in which an algorithm can be considered to be a decision tree, i.e. a sequence of queries or tests that are done adaptively, so the outcome of previous tests can influence the tests performed next. Typically, th…

Why does Decision tree model matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Decision tree model?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Decision tree model.

Tags

  • Computational complexity theory
  • Decision trees
  • Models of computation

Keep exploring