Created
March 24, 2020 02:11
-
-
Save wyy1234567/80992003b113905b8d861e5f81a372d3 to your computer and use it in GitHub Desktop.
create Node class. Each node contains a data, and a next pointer which points to the next node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node | |
attr_accessor :data, :next | |
def initialize(data, next_node = nil) | |
@data = data | |
@next = next_node | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment