Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 26, 2022 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/98bd5c155c0f2cdc6cc4e0d314931ee0 to your computer and use it in GitHub Desktop.
Save parzibyte/98bd5c155c0f2cdc6cc4e0d314931ee0 to your computer and use it in GitHub Desktop.
def eliminar(nodo, busqueda):
if nodo == None:
return
if nodo.dato == busqueda:
return nodo.siguiente
temporal = nodo
while temporal.siguiente != None:
if temporal.siguiente.dato == busqueda:
if temporal.siguiente.siguiente != None:
temporal.siguiente = temporal.siguiente.siguiente
else:
temporal.siguiente = None
return nodo
temporal = temporal.siguiente
return nodo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment