I was doing some problems in python specifically this one:
Implement an algorithm to delete a node in the middle of a singly linked list, given only access to that node
The solution is this:
def deleteNode(linkedlist, node):
if node.next != None:
node.value = node.next.value
node.next = node.next.next
else:
node.value = None
I've done some Java before and the A = B
with objects means A refers to B. According to this problem. Does this mean in the python expression A = B
that A deep-copies B?