Algorithm remove_first(L):
if L.head is None then
Indicate an error: the list is empty.
L.head = L.head.next
L.size = L.size−1
I was left with doubt about memory leak. Since the removal of nodes seems to work only with an exchange of pointers, I was doubtful if the memory, with this exchange, is allocated and inaccessible or not, if the exchange already makes the memory available? I thought of the free function of C, is there any analog method in python to make memory available? If the case.