Class: AVLTree::Node::EmptyNode

Inherits:
AVLTree::Node show all
Defined in:
lib/avl_tree.rb

Constant Summary

Constants inherited from AVLTree::Node

UNDEFINED

Instance Attribute Summary

Attributes inherited from AVLTree::Node

#height, #key, #left, #right, #value

Instance Method Summary collapse

Methods inherited from AVLTree::Node

#delete_max, #delete_min, #each_key, #each_value, #keys, #values

Constructor Details

#initializeEmptyNode

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_heightObject

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_sexpObject



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

Returns:

  • (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

#rotateObject



277
278
279
# File 'lib/avl_tree.rb', line 277

def rotate
  self
end

#sizeObject



246
247
248
# File 'lib/avl_tree.rb', line 246

def size
  0
end

#update_heightObject



281
282
283
# File 'lib/avl_tree.rb', line 281

def update_height
  # intentionally blank
end