Method: Puppet::Graph::RbTreeMap#delete_min
- Defined in:
- lib/puppet/graph/rb_tree_map.rb
#delete_min ⇒ Object
Deletes the item with the smallest key and returns the item. Returns nil if key is not present.
Complexity: O(log n)
map = Containers::TreeMap.new
map.push("MA", "Massachusetts")
map.push("GA", "Georgia")
map.delete_min #=> "Massachusetts"
map.size #=> 1
150 151 152 153 154 155 156 157 158 |
# File 'lib/puppet/graph/rb_tree_map.rb', line 150 def delete_min result = nil if @root @root, result = delete_min_recursive(@root) @root.color = :black if @root @size -= 1 end result end |