Class: AVLTree::Node::EmptyNode
- Inherits:
-
AVLTree::Node
- Object
- AVLTree::Node
- AVLTree::Node::EmptyNode
- Defined in:
- lib/avl_tree.rb
Constant Summary
Constants inherited from AVLTree::Node
Instance Attribute Summary
Attributes inherited from AVLTree::Node
#height, #key, #left, #right, #value
Instance Method Summary collapse
-
#check_height ⇒ Object
for debugging.
-
#delete(key) ⇒ Object
returns [deleted_node, new_root].
- #dump_sexp ⇒ Object
- #dump_tree(io, indent = '') ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ EmptyNode
constructor
A new instance of EmptyNode.
-
#insert(key, value) ⇒ Object
returns new_root.
-
#retrieve(key) ⇒ Object
returns value.
- #rotate ⇒ Object
- #size ⇒ Object
- #update_height ⇒ Object
Methods inherited from AVLTree::Node
#delete_max, #delete_min, #each_key, #each_value, #keys, #values
Constructor Details
#initialize ⇒ EmptyNode
Returns a new instance of EmptyNode.
237 238 239 240 |
# File 'lib/avl_tree.rb', line 237 def initialize @value = nil @height = 0 end |
Instance Method Details
#check_height ⇒ Object
for debugging
286 287 288 |
# File 'lib/avl_tree.rb', line 286 def check_height # intentionally blank end |
#delete(key) ⇒ Object
returns [deleted_node, new_root]
265 266 267 |
# File 'lib/avl_tree.rb', line 265 def delete(key) [self, self] end |
#dump_sexp ⇒ Object
273 274 275 |
# File 'lib/avl_tree.rb', line 273 def dump_sexp # intentionally blank end |
#dump_tree(io, indent = '') ⇒ Object
269 270 271 |
# File 'lib/avl_tree.rb', line 269 def dump_tree(io, indent = '') # intentionally blank end |
#each(&block) ⇒ Object
250 251 252 |
# File 'lib/avl_tree.rb', line 250 def each(&block) # intentionally blank end |
#empty? ⇒ Boolean
242 243 244 |
# File 'lib/avl_tree.rb', line 242 def empty? true end |
#insert(key, value) ⇒ Object
returns new_root
255 256 257 |
# File 'lib/avl_tree.rb', line 255 def insert(key, value) Node.new(key, value) end |
#retrieve(key) ⇒ Object
returns value
260 261 262 |
# File 'lib/avl_tree.rb', line 260 def retrieve(key) UNDEFINED end |
#rotate ⇒ Object
277 278 279 |
# File 'lib/avl_tree.rb', line 277 def rotate self end |
#size ⇒ Object
246 247 248 |
# File 'lib/avl_tree.rb', line 246 def size 0 end |
#update_height ⇒ Object
281 282 283 |
# File 'lib/avl_tree.rb', line 281 def update_height # intentionally blank end |