What is "dummy = Node(-1)"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

4th Dec 2021, 5:02 PM
Saba
Saba - avatar
4 Answers
+ 5
Sure, Beauty
6th Dec 2021, 2:36 AM
CGO!
CGO! - avatar
+ 2
Saba, I don't understand your question. Please, explain more.
5th Dec 2021, 7:53 PM
CGO!
CGO! - avatar
+ 2
Saba i think so Coder might have created a class or a function called Node
6th Dec 2021, 2:35 AM
Pariket Thakur
Pariket Thakur - avatar
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
6th Dec 2021, 9:53 AM
Saba
Saba - avatar