Class: LinkedList::SinglyNode

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

Overview

This node for Singly Linked list implementation.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject

Returns the value of attribute data.



9
10
11
# File 'lib/data_struct/linked_list.rb', line 9

def data
  @data
end

#next_valObject

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