Skip to content

Commit 9d5521f

Browse files
committed
AVL terminology
1 parent 7f7009b commit 9d5521f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/algorithms/explanations/AVLExp.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ this background.
1111

1212
A **binary search tree (BST)** is either empty or else it is a root
1313
node containing a key and two subtrees, which are binary search trees.
14+
We refer to these as t.key, t.left and t.right, respectively (typically
15+
t is represented as *a pointer to* a record and these are the fields
16+
of the record *pointed to* by t).
1417
Binary trees are ordered, so keys in the left subtree are smaller (or
1518
equal to) the key in the root and keys in the right subtree are greater
1619
(or equal to). Normally there is additional data in each node as well

src/algorithms/pseudocode/AVLTreeInsertion.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ AVLT_Insert(t, k) // returns t with key k inserted \\B AVLT_Insert(t, k)
4343
//Both subtrees are Empty and the height is 1
4444
create new node n containing k \\B create new node
4545
\\Note}
46-
return new node containing k \\B return n
47-
\\Expl{ Return a single-node tree with key k (the height is 1).
46+
return a single-node tree containing k \\B return n
47+
\\Expl{ Both subtrees are Empty and its height is 1.
48+
New memory will need to be allocated for it.
4849
This is the base case of the recursion.
4950
\\Expl}
5051
\\In}

0 commit comments

Comments
 (0)