def insertStart(self, data): newNode = Node(data) if not self.head: self.head = newNode else: newNode.nextNode = self.head self.head = newNode
def insertStart(self,data): newNode = Node(data); if not self.head : self.head = newNode; else: newNode.nextNode = self.head; self.head = newNode;
def insertStart(self, data): newNode = Node(data); self.counter += 1; if not self.head: self.head = newNode; else: newNode.nextNode = self.head; self.head = newNode;
def insertStart(self, data): #O(1) self.counter += 1 newNode = Node(data) if not self.head: # If it is a first element self.head = newNode else: newNode.nextNode = self.head self.head = newNode