python常见面试算法
一、冒泡排序
‘‘‘冒泡排序‘‘‘
# coding:utf-8
list = [1, 13, 5, 35, 6, 9, 10]
s = range(len(list))[::-1]
print(s)
for i in s:
for j in range(i):
if list[j] > list[j +1 ]:
list[j], list[j + 1] = list[j + 1], list[j]
print(list)
相关推荐
赶路人儿 2020-11-02
scuyxi 2020-10-25
csdnfelix 2020-10-18
代码之神 2020-10-15
Pokemogo 2020-09-17
MasterCui 2020-09-08
Morelia 2020-09-04
meylovezn 2020-08-30
Hannah 2020-08-19
hugebawu 2020-08-17
scuyxi 2020-08-16
hang0 2020-08-16
higher0 2020-08-11
Tips 2020-08-08
Tristahong 2020-08-05
xiesheng 2020-08-02
huakai 2020-07-26
RememberMePlease 2020-06-26
zangdaiyang 2020-06-25