Skip to content

Commit 5ed3847

Browse files
committed
replace insert! with push!
1 parent abd624e commit 5ed3847

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/splay_tree.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ function Base.delete!(tree::SplayTree{K}, d::K) where K
178178
return tree
179179
end
180180

181-
function Base.insert!(tree::SplayTree{K}, d::K) where K
181+
function Base.push!(tree::SplayTree{K}, d0) where K
182+
d = convert(K, d0)
182183
is_present = search_node(tree, d)
183184
if (is_present !== nothing) && (is_present.data == d)
184185
return tree
@@ -210,11 +211,6 @@ function Base.insert!(tree::SplayTree{K}, d::K) where K
210211
return tree
211212
end
212213

213-
function Base.push!(tree::SplayTree{K}, key0) where K
214-
key = convert(K, key0)
215-
insert!(tree, key)
216-
end
217-
218214
function Base.getindex(tree::SplayTree{K}, ind) where K
219215
@boundscheck (1 <= ind <= tree.count) || throw(KeyError("$ind should be in between 1 and $(tree.count)"))
220216
function traverse_tree_inorder(node::Union{SplayTreeNode, Nothing})

0 commit comments

Comments
 (0)