Created
February 28, 2019 09:08
-
-
Save karellism/a16f52217ed8ea7f4da0896974070640 to your computer and use it in GitHub Desktop.
Linked list example in Python
This file contains 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
# Node class | |
class Node: | |
# Function to initialize the node object | |
def __init__(self, v): | |
self.val = v # Assign value | |
self.next = None # Initialize next as null | |
# Linked List class | |
class ListNode: | |
# Function to initialize the Linked List | |
def __init__(self): | |
self.head = None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment