Class: DSA::LinkedList::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/dsa-ruby/linked_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val = 0, nxt = nil) ⇒ Node

Returns a new instance of Node.



6
7
8
9
# File 'lib/dsa-ruby/linked_list.rb', line 6

def initialize(val = 0, nxt = nil)
  @val = val
  @next = nxt
end

Instance Attribute Details

#nextObject

Returns the value of attribute next.



4
5
6
# File 'lib/dsa-ruby/linked_list.rb', line 4

def next
  @next
end

#valObject

Returns the value of attribute val.



4
5
6
# File 'lib/dsa-ruby/linked_list.rb', line 4

def val
  @val
end