python冒泡算法
2016-06-02 11:43
471 查看
array = [1,2,3,6,5,4,28,2,1,9,3,0,200,2,9,3,2,98,33,988,22,0,223,0,33,78,222,88,32,0,238,883,2,0,23]
for i in range(len(array)):
for j in range(i):
if array[j] > array[j + 1]:
for jj in range(i):
if array[jj] > array[j+1]:
array[jj],array[j+1] = array[j+1],array[jj]
for i in range(len(array)):
for j in range(i):
if array[j] > array[j + 1]:
for jj in range(i):
if array[jj] > array[j+1]:
array[jj],array[j+1] = array[j+1],array[jj]
相关文章推荐
- 一些常用的Python工具库
- python中函数的参数
- ubuntu 安装 pythonenv
- netCDF4-python的安装
- Windows下如何获取与手机设备有关的进程信息(Python版)
- Python2学习笔记(4)
- python常见环境安装
- leetcode 77. Combinations-排列|递归|非递归|Java|Python
- Python——Windows下安装gevent依赖包
- python操作mysql数据库
- Python 递归函数
- 常用的调试器——概述篇
- Python 标准库 —— cgi/html
- python基础回顾
- (selenium 小知识点)解决使用Webdrive打开Firefox不含有插件的问题(python)
- 转帖文章(感谢作者)-pyenv安 3ff0 装与使用-多版本python共存解决方法
- Python 进阶 —— 重访 tuple
- leetcode 48. Rotate Image-矩阵旋转
- Python复杂对象转JSON
- 17个新手常见Python运行时错误