Internal Sort:

Bubble      O(n2)

Selection     O(n2)

Insertion    O(n2)

Shell      O(nlogn)

Merge      O(nlogn)

Heap      O(nlogn)

Quick Sort    O(nlogn)

Tree Sort(BST)  O(nlogn)

Linear Sorting:

Counting Sort    O(n)

BUcket Sort    O(n)

Radix Sort    O(n)

External Sorting:

K chunks of data need to be sorted and a K-way merge has to be completed.     Assembly Line

Problems:

pro22: Nearly Sorted.  Given a array of n elements, each which is at most K positions from its target position, devise an algorithm that sort in O(nlogK).

Insert the first K elements into a binary heap of size K. Insert the next element from the array into the heap, and delete the minimum element from the heap.\

pro35: Nuts and Bolts. We are given a box which contains bolts and nuts. Assume that there are n nuts and n bolts and that each nut matches exactly one bolt. By trying to match a bolt and a nuts we can see which one is bigger, but we cannot compare two bolts or two nuts directly.

We can use divide-and-conquer to solve. Pick a random bolt B[i], Using this bolt to rearrange the array of nuts into three groups of elements:

  •   Nuts smaller than B[i]
  •   Nuts matches B[i]
  •   Nuts larger than B[i]

最新文章

  1. 云计算下PAAS的解析一
  2. DevOps
  3. plist文件
  4. UWP 拉勾客户端
  5. paip.hibernate save 失败的解决
  6. 选择排序的MPI实现
  7. C++内存分配的五种方法
  8. HDU 1172 猜数字(DFS)
  9. javascript获取当前url中的參数
  10. lpc1788IO口模拟IIC
  11. C# 打开文件夹和保存文件夹
  12. Chapter 2 User Authentication, Authorization, and Security(10):创建包含数据库
  13. JDBC事务控制
  14. 工具类:mybatis中使用Threadlocal开启session及关闭session
  15. missing 1 required positional argument: 'on_delete'报错解决方案
  16. Reactnative——安装React Navigation后无法运行项目
  17. DOM对象,控制HTML元素
  18. python全栈开发day75-用户注册页面ajax实现,用户头像上传、预览、展示
  19. Tomcat启动分析(转自:http://docs.huihoo.com/apache/tomcat/heavyz/01-startup.html)
  20. source tree使用经验

热门文章

  1. 7款震撼人心的HTML5CSS3文字特效
  2. 配置Hibernate二级缓存步骤
  3. jQuery 表单验证 jquery.validator.js
  4. (一)Qt界面设计布局
  5. win8.1环境下硬盘安装centos6.5双系统
  6. 使用ANT 生成Xfire 客户端端文件
  7. 如何在Mac下使用TF/SD 卡制作Exynos 4412 u-boot启动盘
  8. 从省市区多重级联想到的,react和jquery的差别
  9. tomcat6.0 数据库连接池配置问题
  10. @RenderSection与@RenderBody