Class: Searching::SkipList::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/searching/skip_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_level, key, value) ⇒ Node

Returns a new instance of Node.



8
9
10
11
12
13
# File 'lib/searching/skip_list.rb', line 8

def initialize(max_level, key, value)
  self.key = key
  self.value = value
  @forward = Array.new max_level
  @forward.map!{|e| NIL_NODE}
end

Instance Attribute Details

#forwardObject (readonly)

Returns the value of attribute forward.



7
8
9
# File 'lib/searching/skip_list.rb', line 7

def forward
  @forward
end

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/searching/skip_list.rb', line 5

def key
  @key
end

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/searching/skip_list.rb', line 6

def value
  @value
end