Class: LinkedList::SinglyNode
- Inherits:
-
Object
- Object
- LinkedList::SinglyNode
- Defined in:
- lib/data_struct/linked_list.rb
Overview
This node for Singly Linked list implementation.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#next_val ⇒ Object
Returns the value of attribute next_val.
Instance Method Summary collapse
-
#initialize(data, next_val = nil) ⇒ SinglyNode
constructor
A new instance of SinglyNode.
Constructor Details
#initialize(data, next_val = nil) ⇒ SinglyNode
Returns a new instance of SinglyNode.
10 11 12 13 |
# File 'lib/data_struct/linked_list.rb', line 10 def initialize(data, next_val = nil) @data = data @next_val = next_val end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/data_struct/linked_list.rb', line 9 def data @data end |
#next_val ⇒ Object
Returns the value of attribute next_val.
9 10 11 |
# File 'lib/data_struct/linked_list.rb', line 9 def next_val @next_val end |