You are viewing a single comment's thread. Return to all comments →
def deleteNode(llist, position): if position == 0: llist = llist.next else: count = 1 temp = llist while temp != None and count < position: temp = temp.next count += 1
# print(temp.data) temp.next = temp.next.next # print(temp.data) return llist
Delete a Node
You are viewing a single comment's thread. Return to all comments →
Python
def deleteNode(llist, position): if position == 0: llist = llist.next else:
count = 1 temp = llist while temp != None and count < position: temp = temp.next count += 1