I've come across a number of tutorials, which define a node class without much more. I want to create a class (much like python's native list data type) which can receive a variable number of parameters and recursively generate node instances as supporting class attributes therein.
From tutorials:
# Singly linked list
class Node():
def __init__(self,value):
self.value = value
self.nextnode = None
a = Node(1)
b = Node(2)
c = Node(3)
a.nextnode = b
b.nextnode = c
I'm not sure if inheritance would be necessary; I think I would need to recursively create node objects for every element in values below. But I'm sure how to implement this.
class LinkedList():
def __init__(self,*values):
# insert code
Is what I'm asking above and beyond what is expected when "linked lists" come up in job interview questions? It's possible that I'm simply confused.
Edit: I came across this link How is Python's List Implemented? and read that python's native lists are dynamic arrays, and perhaps are not as similar to what I'd like to than I had previously thought.