Dataset Viewer
Auto-converted to Parquet Duplicate
function_name
stringlengths
2
38
file_path
stringlengths
23
69
focal_code
stringlengths
211
13.9k
file_content
stringlengths
563
41.1k
language
stringclasses
1 value
function_component
dict
metadata
dict
Base.intersect!
DataStructures.jl/src/accumulator.jl
function Base.intersect!(a::Accumulator, b::Accumulator) for k in union(keys(a), keys(b)) # union not intersection as we want to check both multiplicities va = a[k] vb = b[k] va >= 0 || throw(MultiplicityException(k, va)) vb >= 0 || throw(MultiplicityException(k, vb)) ...
#A counter type """ Accumulator{T, V} A accumulator is a data structure that maintains an accumulated total for each key. The particular case where those totals are integers is a counter. """ struct Accumulator{T, V} <: AbstractDict{T, V} map::Dict{T, V} end ## constructors Accumulator{T, V}()...
julia
{ "argument_definitions": [], "end_line": 241, "name": "Base.intersect!", "signature": "Base.intersect!(a::Accumulator, b::Accumulator)", "start_line": 230 }
{ "module": "" }
left_rotate
DataStructures.jl/src/avl_tree.jl
function left_rotate(z::AVLTreeNode) y = z.rightChild α = y.leftChild y.leftChild = z z.rightChild = α z.height = compute_height(z) y.height = compute_height(y) z.subsize = compute_subtree_size(z) y.subsize = compute_subtree_size(y) return y end
# it has unique keys # leftChild has keys which are less than the node # rightChild has keys which are greater than the node # height stores the height of the subtree. mutable struct AVLTreeNode{K} height::Int8 leftChild::Union{AVLTreeNode{K}, Nothing} rightChild::Union{AVLTreeNode{K}, Nothing} ...
julia
{ "argument_definitions": [ { "definitions": [ "mutable struct AVLTreeNode{K}\n height::Int8\n leftChild::Union{AVLTreeNode{K}, Nothing}\n rightChild::Union{AVLTreeNode{K}, Nothing}\n subsize::Int32\n data::K\n\n AVLTreeNode{K}(d::K) where K = new{K}(1, nothing, nothing, 1, d)\nend...
{ "module": "" }
right_rotate
DataStructures.jl/src/avl_tree.jl
function right_rotate(z::AVLTreeNode) y = z.leftChild α = y.rightChild y.rightChild = z z.leftChild = α z.height = compute_height(z) y.height = compute_height(y) z.subsize = compute_subtree_size(z) y.subsize = compute_subtree_size(y) return y end
# it has unique keys # leftChild has keys which are less than the node # rightChild has keys which are greater than the node # height stores the height of the subtree. mutable struct AVLTreeNode{K} height::Int8 leftChild::Union{AVLTreeNode{K}, Nothing} rightChild::Union{AVLTreeNode{K}, Nothing} ...
julia
{ "argument_definitions": [ { "definitions": [ "mutable struct AVLTreeNode{K}\n height::Int8\n leftChild::Union{AVLTreeNode{K}, Nothing}\n rightChild::Union{AVLTreeNode{K}, Nothing}\n subsize::Int32\n data::K\n\n AVLTreeNode{K}(d::K) where K = new{K}(1, nothing, nothing, 1, d)\nend...
{ "module": "" }
search_node
DataStructures.jl/src/avl_tree.jl
function search_node(tree::AVLTree{K}, d::K) where K prev = nothing node = tree.root while node != nothing && node.data != nothing && node.data != d prev = node if d < node.data node = node.leftChild else node = node.rightChild end end ...
# it has unique keys # leftChild has keys which are less than the node # rightChild has keys which are greater than the node # height stores the height of the subtree. mutable struct AVLTreeNode{K} height::Int8 leftChild::Union{AVLTreeNode{K}, Nothing} rightChild::Union{AVLTreeNode{K}, Nothing} ...
julia
{ "argument_definitions": [ { "definitions": [ "mutable struct AVLTree{T}\n root::AVLTreeNode_or_null{T}\n count::Int\n\n AVLTree{T}() where T = new{T}(nothing, 0)\nend" ], "name": "tree", "type": "AVLTree" }, { "definitions": [ "K" ], "na...
{ "module": "" }
insert_node
DataStructures.jl/src/avl_tree.jl
function insert_node(node::AVLTreeNode{K}, key::K) where K if key < node.data node.leftChild = insert_node(node.leftChild, key) else node.rightChild = insert_node(node.rightChild, key) end node.subsize = compute_subtree_size(node) node.height = compute_height(node) bala...
# it has unique keys # leftChild has keys which are less than the node # rightChild has keys which are greater than the node # height stores the height of the subtree. mutable struct AVLTreeNode{K} height::Int8 leftChild::Union{AVLTreeNode{K}, Nothing} rightChild::Union{AVLTreeNode{K}, Nothing} ...
julia
{ "argument_definitions": [ { "definitions": [ "mutable struct AVLTreeNode{K}\n height::Int8\n leftChild::Union{AVLTreeNode{K}, Nothing}\n rightChild::Union{AVLTreeNode{K}, Nothing}\n subsize::Int32\n data::K\n\n AVLTreeNode{K}(d::K) where K = new{K}(1, nothing, nothing, 1, d)\nend...
{ "module": "" }
delete_node!
DataStructures.jl/src/avl_tree.jl
function delete_node!(node::AVLTreeNode{K}, key::K) where K if key < node.data node.leftChild = delete_node!(node.leftChild, key) elseif key > node.data node.rightChild = delete_node!(node.rightChild, key) else if node.leftChild == nothing result = node.rightChild ...
# it has unique keys # leftChild has keys which are less than the node # rightChild has keys which are greater than the node # height stores the height of the subtree. mutable struct AVLTreeNode{K} height::Int8 leftChild::Union{AVLTreeNode{K}, Nothing} rightChild::Union{AVLTreeNode{K}, Nothing} ...
julia
{ "argument_definitions": [ { "definitions": [ "mutable struct AVLTreeNode{K}\n height::Int8\n leftChild::Union{AVLTreeNode{K}, Nothing}\n rightChild::Union{AVLTreeNode{K}, Nothing}\n subsize::Int32\n data::K\n\n AVLTreeNode{K}(d::K) where K = new{K}(1, nothing, nothing, 1, d)\nend...
{ "module": "" }
sorted_rank
DataStructures.jl/src/avl_tree.jl
function sorted_rank(tree::AVLTree{K}, key::K) where K !haskey(tree, key) && throw(KeyError(key)) node = tree.root rank = 0 while node.data != key if (node.data < key) rank += (1 + get_subsize(node.leftChild)) node = node.rightChild else node ...
# it has unique keys # leftChild has keys which are less than the node # rightChild has keys which are greater than the node # height stores the height of the subtree. mutable struct AVLTreeNode{K} height::Int8 leftChild::Union{AVLTreeNode{K}, Nothing} rightChild::Union{AVLTreeNode{K}, Nothing} ...
julia
{ "argument_definitions": [ { "definitions": [ "mutable struct AVLTree{T}\n root::AVLTreeNode_or_null{T}\n count::Int\n\n AVLTree{T}() where T = new{T}(nothing, 0)\nend" ], "name": "tree", "type": "AVLTree" }, { "definitions": [ "K" ], "na...
{ "module": "" }
traverse_tree
DataStructures.jl/src/avl_tree.jl
function Base.getindex(tree::AVLTree{K}, ind::Integer) where K @boundscheck (1 <= ind <= tree.count) || throw(BoundsError("$ind should be in between 1 and $(tree.count)")) function traverse_tree(node::AVLTreeNode_or_null, idx) if (node != nothing) L = get_subsize(node.leftChild) ...
# it has unique keys # leftChild has keys which are less than the node # rightChild has keys which are greater than the node # height stores the height of the subtree. mutable struct AVLTreeNode{K} height::Int8 leftChild::Union{AVLTreeNode{K}, Nothing} rightChild::Union{AVLTreeNode{K}, Nothing} ...
julia
{ "argument_definitions": [], "end_line": 345, "name": "traverse_tree", "signature": "Base.getindex(tree::AVLTree{K}, ind::Integer) where K", "start_line": 329 }
{ "module": "" }
Base.empty!
DataStructures.jl/src/balanced_tree.jl
function Base.empty!(t::BalancedTree23) resize!(t.data,2) initializeData!(t.data) resize!(t.tree,1) initializeTree!(t.tree) t.depth = 1 t.rootloc = 1 empty!(t.freetreeinds) empty!(t.freedatainds) empty!(t.useddatacells) push!(t.useddatacells, 1, 2) return nothing ...
## This file implements 2-3 trees for sorted containers. ## The types and functions in this file are not exported; they ## are meant to be used by SortedDict, MultiMap and SortedSet. ## A 2-3 tree is a rooted trees in which all leaves are at the same ## depth (i.e., it is "balanced") ## and in which each internal ...
julia
{ "argument_definitions": [], "end_line": 250, "name": "Base.empty!", "signature": "Base.empty!(t::BalancedTree23)", "start_line": 238 }
{ "module": "" }
findkeyless
DataStructures.jl/src/balanced_tree.jl
function findkeyless(t::BalancedTree23, k) curnode = t.rootloc for depthcount = 1 : t.depth - 1 @inbounds thisnode = t.tree[curnode] cmp = thisnode.child3 == 0 ? cmp2le_nonleaf(t.ord, thisnode, k) : cmp3le_nonleaf(t.ord, thisnode, k) curnode = cmp == ...
## This file implements 2-3 trees for sorted containers. ## The types and functions in this file are not exported; they ## are meant to be used by SortedDict, MultiMap and SortedSet. ## A 2-3 tree is a rooted trees in which all leaves are at the same ## depth (i.e., it is "balanced") ## and in which each internal ...
julia
{ "argument_definitions": [ { "definitions": [ "mutable struct BalancedTree23{K, D, Ord <: Ordering}\n ord::Ord\n data::Vector{KDRec{K,D}}\n tree::Vector{TreeNode{K}}\n rootloc::Int\n depth::Int\n freetreeinds::Vector{Int}\n freedatainds::Vector{Int}\n useddatacells::BitSet\n...
{ "module": "" }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
4