def insertAfter(self, p, value): node = ListNode(value) node.setPointerTo(p.ptr) p.setPointerTo(node)
def unshift(self, value): node = ListNode(value) if self.lst != None: node.setPointerTo(self.lst) self.lst = node
def insertAfter(self, value, p): node = ListNode(value) node.setPointerTo(p.ptr) p.setPointerTo(node) return node