Class: DSA::SkipListLevel
- Inherits:
-
Object
- Object
- DSA::SkipListLevel
- Defined in:
- lib/DSA/skip_list.rb
Constant Summary collapse
- SENTINEL =
Object.new
Instance Attribute Summary collapse
-
#head ⇒ Object
Returns the value of attribute head.
-
#tail ⇒ Object
Returns the value of attribute tail.
Instance Method Summary collapse
-
#initialize ⇒ SkipListLevel
constructor
A new instance of SkipListLevel.
Constructor Details
#initialize ⇒ SkipListLevel
Returns a new instance of SkipListLevel.
21 22 23 24 25 26 |
# File 'lib/DSA/skip_list.rb', line 21 def initialize @head = SkipListNode.new(SENTINEL, 'Sentinel') @tail = SkipListNode.new(SENTINEL, 'Sentinel') @head.next = @tail @tail.prev = @head end |
Instance Attribute Details
#head ⇒ Object
Returns the value of attribute head.
19 20 21 |
# File 'lib/DSA/skip_list.rb', line 19 def head @head end |
#tail ⇒ Object
Returns the value of attribute tail.
19 20 21 |
# File 'lib/DSA/skip_list.rb', line 19 def tail @tail end |