Diese Funktion „reinigt“ Duplikate aus einer ListeWie rekursive Form von Reinigungsduplikate in eine verkettete Liste einfügen?
verknüpft wiedef clean (self):
key_node = self._front
while key_node is not None:
# Loop through every node - compare each node with the rest
previous = key_node
current = key_node._next
while current is not None:
# Always search to the end of the list (may have > 1 duplicate)
if current._value == key_node._value:
# Remove the current node by connecting the node before it
# to the node after it.
previous._next = current._next
self._count -= 1
else:
previous = current
# Move to the _next node.
current = current._next
# Check for duplicates of the _next remaining node in the list
key_node = key_node._next
return
Wie würde die rekursive Art und Weise für diese Funktion aussehen?