Skip to content

Commit 5785868

Browse files
committed
few changes in docs
1 parent 62bfb1f commit 5785868

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

docs/src/avl_tree.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DocTestSetup = :(using DataStructures)
44

55
# AVL Tree
66

7-
The `AVLTree` type is an implementation of AVL Tree in Julia. It is a self-balancing binary search tree where balancing occurs based on the difference of height of the left subtree and the right subtree. Operations such as search, insert and delete can be done in `O(log n)` complexity, where `n` is the number of nodes in the `AVLTree`.
7+
The `AVLTree` type is an implementation of AVL Tree in Julia. It is a self-balancing binary search tree where balancing occurs based on the difference of height of the left subtree and the right subtree. Operations such as search, insert and delete can be done in `O(log n)` complexity, where `n` is the number of nodes in the `AVLTree`. Order-statistics on the keys can also be done in `O(log n)`.
88

99
Examples:
1010

@@ -18,7 +18,7 @@ julia> for k in 1:2:20
1818
julia> haskey(tree, 3)
1919
true
2020
21-
julia> tree[4]
21+
julia> tree[4] # this operation is O(log n)
2222
7
2323
2424
julia> for k in 1:2:10

src/avl_tree.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ end
176176
function Base.delete!(tree::AVLTree{K}, d::K) where K
177177

178178
function delete_node!(node::Union{AVLTreeNode, Nothing}, key)
179-
if node == nothing || node.data == nothing
180-
return nothing
181-
elseif key < node.data
179+
if key < node.data
182180
node.leftChild = delete_node!(node.leftChild, key)
183181
elseif key > node.data
184182
node.rightChild = delete_node!(node.rightChild, key)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ tests = ["deprecations",
3333
"ordered_robin_dict",
3434
"dibit_vector",
3535
"red_black_tree",
36-
"avl_tree",
36+
"avl_tree"
3737
]
3838

3939
if length(ARGS) > 0

0 commit comments

Comments
 (0)