Class: Algorithms::Containers::Heap::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/containers/heap.rb

Overview

Node class used internally

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Node

Returns a new instance of Node.



310
311
312
313
314
315
316
317
# File 'lib/containers/heap.rb', line 310

def initialize(key, value)
  @key = key
  @value = value
  @degree = 0
  @marked = false
  @right = self
  @left = self
end

Instance Attribute Details

#childObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def child
  @child
end

#degreeObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def degree
  @degree
end

#keyObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def key
  @key
end

#leftObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def left
  @left
end

#markedObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def marked
  @marked
end

#parentObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def parent
  @parent
end

#rightObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def right
  @right
end

#valueObject

:nodoc:



308
309
310
# File 'lib/containers/heap.rb', line 308

def value
  @value
end

Instance Method Details

#marked?Boolean

Returns:

  • (Boolean)


319
320
321
# File 'lib/containers/heap.rb', line 319

def marked?
  @marked == true
end