+ 1
What is "dummy = Node(-1)"?
I am learning about Linked lists in python and i found sth that i don't know what it is exactly!!! dummy = Node(-1) Could you plz help me? this a part of the code: def Copy-Random-List(self, head: "node")->"node": dummy = node(-1) #? dummy.next = head cur = head while cur: temp = node(cur.val) temp.next = cur.next cur.next = temp cur = temp.next cur = head
4 Answers
+ 5
Sure, Beauty
+ 2
Saba, I don't understand your question.
Please, explain more.
+ 2
Saba i think so
Coder might have created a class or a function called Node
0
this a part of the code:
def Copy-Random-List(self, head: "node")->"node":
dummy = node(-1) #?
dummy.next = head
cur = head
while cur:
temp = node(cur.val)
temp.next = cur.next
cur.next = temp
cur = temp.next
cur = head