11 2015 档案

摘要:简单选择排序思想:第1趟,在待排序记录r[1]~r[n]中选出最小的记录,将它与r[1]交换;第2趟,在待排序记录r[2]~r[n]中选出最小的记录,将它与r[2]交换;以此类推,第i趟在待排序记录r[i]~r[n]中选出最小的记录,将它与r[i]交换,使有序序列不断增长直到全部排序完毕。#incl... 阅读全文
posted @ 2015-11-16 16:21 ydp 阅读(143) 评论(0) 推荐(0)
摘要:思想:1、数组A[n]被划分两个字数组A[0..q-1]和A[q+1..n],使得对于数组A[0..q-1]中的元素都小于A[q], A[q+1..n]中的元素都大于等于A[q]。2、通过递归调用快速排序,对字数组A[0..q-1]和A[q+1..n]进行排序。因为两个字数组已经是就地排好序的了,整... 阅读全文
posted @ 2015-11-12 15:25 ydp 阅读(200) 评论(0) 推荐(0)
摘要:#include #include bubbleSort(int *p,int length);int main(){ int a[] = {1,3,2,8,5,9,7,6,4,0}; int length = 10; int i; bubbleSort(&a,10); ... 阅读全文
posted @ 2015-11-10 16:27 ydp 阅读(167) 评论(0) 推荐(0)