Skip to content

Instantly share code, notes, and snippets.

@ricardosiri68
Created May 2, 2014 00:23
Show Gist options
  • Select an option

  • Save ricardosiri68/730cca73d5ace90f93f8 to your computer and use it in GitHub Desktop.

Select an option

Save ricardosiri68/730cca73d5ace90f93f8 to your computer and use it in GitHub Desktop.
def my_list_sort(l):
"""
*--------------------------------------------------------------------------
* ordena una lista de forma binaria
*--------------------------------------------------------------------------
* l: es la lista a ordenar
* @return: retorna la lista ordenada en una etapa
"""
for i in range(len(l)):
try:
if l[i] > l[i + 1]:
l[i], l[i + 1] = l[i + 1], l[i]
return my_list_sort(l)
except IndexError:
pass
return l
print(my_list_sort([4, 9, 6, 7]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment