class Minion::SplayTreeMap(K, V)
- Minion::SplayTreeMap(K, V)
- Reference
- Object
Defined in:
minion/splay_tree_map.crConstructors
Instance Method Summary
- #[](key : K)
- #[]=(key, value)
- #clear
- #delete(key)
- #descend_from(node, height_limit, current_height = 0)
- #each
-
#each(&blk : K, V -> )
TODO Make this more like other containers in crystal.
-
#each_descend_from(node, &blk : K, V -> )
This will recursively walk the whole tree, calling the given block for each node.
-
#find(key : K)
Find a key without splaying
- #get(key : K)
- #get_root
- #has_key?(key)
- #height(key)
- #height
- #keys : Array(K)
- #max
- #min
-
#prune
This will remove all of the leaves at the end of the tree branches.
- #prune_from(node)
-
#push(key, value)
TODO This is surprisingly slow.
- #size
- #to_a
- #values : Array(V)
Constructor Detail
Instance Method Detail
This will recursively walk the whole tree, calling the given block for each node.
This will remove all of the leaves at the end of the tree branches. That is, every node that does not have any children. This will tend to remove the least used elements from the tree. This function is expensive, as implemented, as it must walk every node in the tree.
TODO Come up with a more efficient way of getting this same effect.
TODO This is surprisingly slow. I assume it is due to the overhead of declaring nodes on the heap. Is there a way to make them work as structs instead of classes?