Recipe 5.11. Showing off quicksort in Three Lines
来源:互联网 发布:网络开拓视野的实例 编辑:程序博客网 时间:2024/05/16 20:30
Functional programming languages, of which Haskell is a great example, are splendid animals, but Python can hold its own in such company:
def qsort(L):
if len(L) <= 1: return L
return qsort([lt for lt in L[1:] if lt < L[0]]) + L[0:1] + \
qsort([ge for ge in L[1:] if ge >= L[0]])
def qsort(L):
if len(L) <= 1: return L
return qsort([lt for lt in L[1:] if lt < L[0]]) + L[0:1] + \
qsort([ge for ge in L[1:] if ge >= L[0]])
- Recipe 5.11. Showing off quicksort in Three Lines
- 英语练习82 Showing off
- hunnu 11163 three lines #DFS
- sicily 9192. Three Lines 中大
- Two Lines In Heaven
- Showing Images and Text in Toolbar
- showing activity indicator in Table cells
- GSD status showing offline in 11g
- Showing a Spring transaction in log4j
- Example: Showing a Message in JavaMail
- Quicksort in C++
- quicksort in clrs
- Selection in QuickSort
- Inserting text in multiple lines
- 1.2 Lines in the plane
- comment/uncomment lines in Vim
- Starting off in Glade/GTK+
- read .off file in matlab
- C_basis
- Recipe 5.10. Selecting the nth Smallest Element of a Sequence
- 设计模式之-单例模式(Singleton)及java中==与equals的区别
- [展翅孔夫子图书数据上传软件] 破解版
- Android智能指针sp wp详解
- Recipe 5.11. Showing off quicksort in Three Lines
- HDU 1011 Starship Troopers
- BPMN这点事-那段悲催的历史(上)
- EFS加密和解密
- Web前端开发:DIV+CSS网页布局总结
- shell的一些记录
- 变量的作用域及生存期
- 手机程序java认证客户端套接字(Socket)的超时
- poj2388 水题 各种排序