ArticleslgStudy

computer science

Stern–Brocot tree

Stern–Brocot tree 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 Stern–Brocot tree rather than just read about it. In short: In number theory, the Stern–Brocot tree is an infinite complete binary tree whose vertices correspond one-for-one to the positive rational numbers, whose values are ordered from the left to the right as in a binary search tree. The Stern–Brocot tree was introduced independently by Moritz Stern (1858) and Achille Brocot (1861).

Stern–Brocot tree — main illustration
Stern–Brocot tree — illustration

Key takeaways

  • Stern–Brocot tree 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 Stern–Brocot tree to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Stern–Brocot tree from memory before moving on to harder problems.

Reference excerpt

In number theory, the Stern–Brocot tree is an infinite complete binary tree whose vertices correspond one-for-one to the positive rational numbers, whose values are ordered from the left to the right as in a binary search tree. The Stern–Brocot tree was introduced independently by Moritz Stern (1858) and Achille Brocot (1861). Stern was a German number theorist; Brocot was a French clockmaker who used the Stern–Brocot tree to design systems of gears with a gear ratio close to some desired value by finding a ratio of smooth numbers near that value. The root of the Stern–Brocot tree corresponds to the number 1. The parent-child relation between numbers in the Stern–Brocot tree may be defined in terms of simple continued fractions or mediants, and a path in the tree from the root to any other number q provides a sequence of approximations to q with smaller denominators than q. Because the tree contains each positive rational number exactly once, a breadth first search of the tree provides a method of listing all positive rationals that is closely related to Farey sequences. The left subtree of the Stern–Brocot tree, containing the rational numbers in the range (0,1), is called the Farey tree.

Generating rule Each vertex in the tree can be associated with a triple of fractions consisting of three fractions in the same row as the vertex, namely the fraction immediately to the left of the vertex, the fraction at the vertex itself, and the fraction immediately to the right of the vertex. (Refer to the figure above.) The left and right fractions do not correspond to vertices in the same row as the vertex, but rather to vertices in some preceding row. Each such fraction can be understood as labeling the region of the plane bounded by two infinite paths descending from the preceding vertex labeled by the same fraction. The second element of a triple will always be the mediant of the first and third elements. For example, the root is associated with ( 0 1 , 1 1 , 1 0 ) {\displaystyle {\bigl (}{\tfrac {0}{1}},{\tfrac {1}{1}},{\tfrac {1}{0}}{\bigr )}} and its left and right descendents are associated with ( 0 1 , 1 2 , 1 1 ) {\displaystyle {\bigl (}{\tfrac {0}{1}},{\tfrac {1}{2}},{\tfrac {1}{1}}{\bigr )}} and ( 1 1 , 2 1 , 1 0 ) . {\displaystyle {\bigl (}{\tfrac {1}{1}},{\tfrac {2}{1}},{\tfrac {1}{0}}{\bigr )}.} The tree is generated by the following rule:

… excerpt ends here. Continue reading the full article.

Illustrations

Stern–Brocot tree: The Stern–Brocot tree, and the Stern–Brocot sequences of order i for i = 1, 2, 3, 4
The Stern–Brocot tree, and the Stern–Brocot sequences of order i for i = 1, 2, 3, 4

Worked examples

Example 1 — a first encounter with Stern–Brocot tree

Start with the simplest possible case. Write down what Stern–Brocot tree 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 Stern–Brocot tree 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 Stern–Brocot tree 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 Stern–Brocot tree

In research
Stern–Brocot tree 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 Stern–Brocot tree 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
Stern–Brocot tree is common in secondary-school and first-year university syllabi. It links to neighbouring topics Continued fractions, Trees (data structures), so understanding it makes those chapters shorter.
In everyday life
Look for Stern–Brocot tree 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 “Stern–Brocot tree” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Stern–Brocot tree in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Stern–Brocot tree 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 Stern–Brocot tree out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Stern–Brocot tree in simple terms?

In number theory, the Stern–Brocot tree is an infinite complete binary tree whose vertices correspond one-for-one to the positive rational numbers, whose values are ordered from the left to the right as in a binary search tree. The Stern–Brocot tree was introduced independently by Moritz Stern (185…

Why does Stern–Brocot tree 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 Stern–Brocot tree?

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 Stern–Brocot tree.

Tags

  • Continued fractions
  • Trees (data structures)

Keep exploring