# Left Leaning Red Black Tree

## Definition

A BST such that:

* No node has two red links connected to it.
* Every path from root to null link has the same number of black links.
* Red links lean left.

![](/files/jyzV0BE442PvisZ5k0MM)

![](/files/jGeyLUXa6cPHFoNuFuQM)

{% hint style="success" %}

#### Properties

* Height of tree is ≤ 2 lg N in the worst case.
* Every path from root to null link has same number of black links.
* Never two red links in-a-row.
  {% endhint %}

## **Sample Red Black Tree with 255 Random Nodes**

![](/files/FM2qWZVrekNDpdMadQTl)

## **Balancing Red Black Tree**

![](/files/N6aID2kVit4EN6JultvU)

## **Complexity Analysis with other Data Structures**

![](/files/7IIf2gSTVoPHqQSmXnUF)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.sunilgudivada.dev/notebook/data-structures-and-algorithms/topics/binary-search-tree/red-black-tree.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
