Class: LinkedList::DoublyNode

Inherits:
Object
  • Object
show all
Defined in:
lib/data_struct/linked_list.rb

Overview

This node for Doubly Linked list implementation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, pre_val = nil, next_val = nil) ⇒ DoublyNode

Returns a new instance of DoublyNode.



18
19
20
21
22
# File 'lib/data_struct/linked_list.rb', line 18

def initialize(data, pre_val = nil, next_val = nil)
  @data = data
  @next_val = next_val
  @pre_val = pre_val
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



17
18
19
# File 'lib/data_struct/linked_list.rb', line 17

def data
  @data
end

#next_valObject

Returns the value of attribute next_val.



17
18
19
# File 'lib/data_struct/linked_list.rb', line 17

def next_val
  @next_val
end

#pre_valObject

Returns the value of attribute pre_val.



17
18
19
# File 'lib/data_struct/linked_list.rb', line 17

def pre_val
  @pre_val
end