摘要: We programmers are weird creatures. We love writing code. But when it comes to reading it we usually shy away. After all, writing code is so much more fun, and reading code is hard — sometimes almost ... 阅读全文
posted @ 2013-01-16 23:56 sqtds 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 插入排序(Insertion Sort)的基本思想是:每次将一个待排序的记录,按其关键字大小插入到前面已经排好序的子文件中的适当位置,直到全部记录插入完成为止。 本节介绍两种插入排序方法:直接插入排序和希尔排序。 直接插入排序基本思想 1、基本思想 假设待排序的记录存放在数组R[1..n]中。初始时,R[1]自成1个有序区,无序区为R[2..n]。从... 阅读全文
posted @ 2013-01-16 23:26 sqtds 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序:废话不多说,直接上代码,注意2中冒泡方法的不同。 package com.sqtds.algorithm.sort;/** * User: sqtds * Date: 13-1-15 * Time: 下午3:03 */public class Bubble { public static void sort(int[] array){ int i ,j ;... 阅读全文
posted @ 2013-01-16 23:08 sqtds 阅读(192) 评论(0) 推荐(0) 编辑