0. Linked List Template
In [1]:
Copied!
class Node:
def __init__(self, data):
self.data = data
## comment prev to use it for singly lists
self.prev = None
self.next = None
def __repr__(self):
return "<Node: %s>" % self.data
class Node:
def __init__(self, data):
self.data = data
## comment prev to use it for singly lists
self.prev = None
self.next = None
def __repr__(self):
return "" % self.data
In [2]:
Copied!
class LinkedList:
def __init__(self):
self.head = None
self.__count = 0
def __repr__(self):
pass
def __iter__(self):
pass
def __len__(self):
return self.__count
def is_empty(self):
return self.head == None
def add_head(self):
pass
def add_tail(self):
pass
def insert(self):
pass
def traverse(self):
pass
def remove_key(self):
pass
def remove_at_index(self):
pass
def node_at_index(self):
pass
def search(self):
pass
def reverse(self):
pass
class LinkedList:
def __init__(self):
self.head = None
self.__count = 0
def __repr__(self):
pass
def __iter__(self):
pass
def __len__(self):
return self.__count
def is_empty(self):
return self.head == None
def add_head(self):
pass
def add_tail(self):
pass
def insert(self):
pass
def traverse(self):
pass
def remove_key(self):
pass
def remove_at_index(self):
pass
def node_at_index(self):
pass
def search(self):
pass
def reverse(self):
pass
In [ ]:
Copied!