File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ # AVL tree
2
+
3
+ AVL tree is a self balancing form of Binary Tree in which height of subtrees differ at most by only 1.
4
+
5
+
6
+ # Properties
7
+
8
+ A subtree dissatisfies AVL tree properties -- if ` balance ` factor is greater than ` 1 ` or lesser than ` -1 `
9
+ where the balance factor is defined as following:
10
+
11
+ balance = height(left_subtree) − height(right_subtree)
12
+
13
+ (12/b:-2)
14
+ \
15
+ \
16
+ (13/b:-1)
17
+ \
18
+ \
19
+ (14/b:0)
20
+
21
+ # Searching and Inserting
22
+
23
+ Searching is done through a recursive function which searches the tree from top-down based on Binary Tree rules.
24
+
25
+ Inserting into the tree is similar to Binary Tree but differs by one additional opeartion which updates the ` balance ` variable.
26
+
27
+
28
+ # See also
29
+ [ AVL tree on Wikipedia] ( https://en.wikipedia.org/wiki/AVL_tree )
You can’t perform that action at this time.
0 commit comments