Answer the question
In order to leave comments, you need to log in
How to properly organize the work of the insert function?
When testing, the following error occurs:
def insert(self,item,pos):
current = self.head
found = False
count = 0
while not found:
if count == pos-2:
found = True
else :
current = current.getNext()
count = count + 1
temp = Node(item)
temp.setNext(current.getNext())
current.setNext(temp)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question