ArticleslgStudy

science

WAVL tree

WAVL tree is a 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 WAVL tree rather than just read about it. In short: In computer science, a WAVL tree or weak AVL tree is a self-balancing binary search tree. WAVL trees are named after AVL trees, another type of balanced search tree, and are closely related both to AVL trees and red–black trees, which all fall into a common framework of rank balanced trees.

WAVL tree — main illustration
WAVL tree — illustration

Key takeaways

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

Reference excerpt

In computer science, a WAVL tree or weak AVL tree is a self-balancing binary search tree. WAVL trees are named after AVL trees, another type of balanced search tree, and are closely related both to AVL trees and red–black trees, which all fall into a common framework of rank balanced trees. Like other balanced binary search trees, WAVL trees can handle insertion, deletion, and search operations in time O(log n) per operation. WAVL trees are designed to combine some of the best properties of both AVL trees and red–black trees. One advantage of AVL trees over red–black trees is being more balanced: they have height at most log φ ⁡ n ≈ 1.44 log 2 ⁡ n {\displaystyle \log _{\varphi }n\approx 1.44\log _{2}n} (for a tree with n data items, where φ {\displaystyle \varphi } is the golden ratio), while red–black trees have larger maximum height, 2 log 2 ⁡ n {\displaystyle 2\log _{2}n} . If a WAVL tree is created using only insertions, without deletions, then it has the same small height bound that an AVL tree has. On the other hand, red–black trees have the advantage over AVL trees in lesser restructuring of their trees. In AVL trees, each deletion may require a logarithmic number of tree rotation operations, while red–black trees have simpler deletion operations that use only a constant number of tree rotations. WAVL trees, like red–black trees, use only a constant number of tree rotations, and the constant is even better than for red–black trees. WAVL trees were introduced by Haeupler, Sen & Tarjan (2015). The same authors also provided a common view of AVL trees, WAVL trees, and red–black trees as all being a type of rank-balanced tree.

The rank balanced trees framework Different binary search trees have different algorithms for insert/delete and balancing algorithms, making it difficult for a systematic study. The authors of Haeupler, Sen & Tarjan (2015) introduce the rank balanced trees framework for unifying the study of binary search tree by defining the rank binary tree, and each binary search tree follows by specific constraints applied to the rank function. Note that the framework doesn't specify the algorithms in which these trees are implemented. A rank binary tree is a binary tree where each node x is associated with a rank r(x). By convention, empty node has rank -1. For a node x that is not the root, the rank difference is r ( p ( x ) ) − r ( x ) {\displaystyle r(p(x))-r(x)} , and such a node is called an i-child if the rank difference is i. A node is of type i , j {\displaystyle i,j} if the rank difference of its left child and right child is i and j (disregarding ordering). With that, we can define additional rules, which correspond to different trees:

AVL rule, which corresponds to AVL tree: each node is of type 1,1 or 1,2. 2-3 rule, which corresponds to the binarized 2-3 tree: each node is of type 0,1 or 1,1, and no parent of a 0-child is a 0-child. Red black rule, which corresponds to Red-black tree: all rank differences are 0 or 1, and no parent of a 0-child is a 0-child. Note that the red-black rule generalizes the 2-3 rule by allowing for 0,0 type node. So far all these rules are symmetric for the left node and the right node. By breaking such symmetries, it gives rise to other rules:

Right-Leaning Two-Three Rule, which corresponds to the right leaning binarized 2-3 tree: Every node is 1,1 or 0,1, no parent of a 0-child is a 0-child, and no 0-child is left. Left-Leaning Two-Three Rule, which corresponds to the left leaning binarized 2-3 tree: Every node is 1,1 or 0,1, no parent of a 0-child is a 0-child, and no 0-child is right. Right-leaning red-black rule, which corresponds to Reft-leaning red–black tree: no parent of a 0-child is a 0-child, and no 0-child of a 0,1-node is left. Left-leaning red-black rule, which corresponds to Left-leaning red–black tree: all rank differences are 0 or 1, no parent of a 0-child is a 0-child, and no 0-child of a 0,1-node is right. The weak AVL tree is defined by the weak AVL rule:

Weak AVL rule: all rank differences are 1 or 2, and all leaf nodes have rank 0. Note that weak AVL tree generalizes the AVL tree by allowing for 2,2 type node. A simple proof shows that a weak AVL tree can be colored in a way that represents a red-black tree. So in a sense, weak AVL tree combines the properties of AVL tree and red-black tree.

Definition As with binary search trees more generally, a WAVL tree consists of a collection of nodes, of two types: internal nodes and external nodes. An internal node stores a data item, and is linked to its parent (except for a designated root node that has no parent) and to exactly two children in the tree, the left child and the right child. An external node carries no data, and has a link only to its parent in the tree. These nodes are arranged to form a binary tree, so that for any internal node x the parents of the left and right children of x are x itself. The external nodes form the leaves of the tree. The data items are arranged in the tree in such a way that an inorder traversal of the tree lists the data items in sorted order. What distinguishes WAVL trees from other types of binary search tree is its use of ranks. These are numbers, associated with each node, that provide an approximation to the distance from the node to its farthest leaf descendant. Unlike in AVL trees, where ranks are defined to be the same as nodes' heights, ranks do not always equal to heights in WAVL trees. The rank difference of node x is defined as the difference between the rank of x's parent and the rank of x. The ranks are required to obey the following properties:

… excerpt ends here. Continue reading the full article.

Illustrations

WAVL tree: Fibonacci Tree With Ranks After Delete
Fibonacci Tree With Ranks After Delete

Worked examples

Example 1 — a first encounter with WAVL tree

Start with the simplest possible case. Write down what WAVL tree claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 WAVL 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 WAVL 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 WAVL tree

In research
WAVL tree appears in 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 WAVL 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
WAVL tree is common in secondary-school and first-year university syllabi. It links to neighbouring topics Binary trees, Search trees, so understanding it makes those chapters shorter.
In everyday life
Look for WAVL 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.

Affiliate

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

How to study WAVL tree in 20 minutes

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

Frequently asked questions

What is WAVL tree in simple terms?

In computer science, a WAVL tree or weak AVL tree is a self-balancing binary search tree. WAVL trees are named after AVL trees, another type of balanced search tree, and are closely related both to AVL trees and red–black trees, which all fall into a common framework of rank balanced trees.

Why does WAVL tree matter?

Because it connects several 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 WAVL 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 WAVL tree.

Tags

  • Binary trees
  • Search trees

Keep exploring