File tree Expand file tree Collapse file tree
src/main/java/org/alda/structure/tree/bst/bbt Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .alda .structure .tree .bst .bbt ;
2+
3+ /**
4+ * @author bcExpt1123
5+ *
6+ * <h1>BBT: Balanced Binary Tree</h1>
7+ *
8+ * <h2>Red-Black Tree</h2>
9+ * <p>A <b>Red-Black Tree</b> is a self-balancing binary search tree with additional properties compared to AVL trees.</p>
10+ *
11+ * <h2>Red-Black Properties</h2>
12+ * <ul>
13+ * <li>Every node is colored either <b>red</b> or <b>black</b>.</li>
14+ * <li>The root node is always <b>black</b>.</li>
15+ * <li>All leaf nodes (NIL nodes) are <b>black</b>.</li>
16+ * <li>Red nodes must have black children (no two consecutive red nodes).</li>
17+ * <li>Every path from a node to its descendant NIL nodes must contain the same number of black nodes.</li>
18+ * </ul>
19+ *
20+ * <h2>Operations</h2>
21+ * <ul>
22+ * <li><b>Recoloring & Rotations</b>: Used to maintain balance after insertions and deletions.</li>
23+ * <li><b>Insertion</b>: After inserting a node, Red-Black properties may be violated, requiring rotations and recoloring.</li>
24+ * <li><b>Deletion</b>: Removing a node may cause an imbalance, requiring rebalancing through rotations and recoloring.</li>
25+ * </ul>
26+ *
27+ * <h2>Time Complexity</h2>
28+ * <p>Red-Black Trees ensure efficient operations with O(log n) complexity:</p>
29+ * <ul>
30+ * <li><b>Search</b>: O(log n)</li>
31+ * <li><b>Insertion</b>: O(log n)</li>
32+ * <li><b>Deletion</b>: O(log n)</li>
33+ * </ul>
34+ */
35+
36+ public class RBT {
37+ }
You can’t perform that action at this time.
0 commit comments