摘要: Merge sort is based on Divide and conquer method. It takes the list to be sorted and divide it in half to create two unsorted lists. The two unsorted lists are then sorted and merged to get a sorted l... 阅读全文
posted @ 2013-03-21 22:41 Gigbit 阅读(341) 评论(0) 推荐(0) 编辑
摘要: Shell sort works by comparing elements that are distant rather than adjacent elements in an array or list where adjacent elements are compared. Shellsort uses an increment sequence. The increment size... 阅读全文
posted @ 2013-03-21 22:16 Gigbit 阅读(256) 评论(0) 推荐(0) 编辑
摘要: The idea of the selection sort is to find the smallest element in the list and exchange it with the element in the first position. Then, find the second smallest element and exchange it with the eleme... 阅读全文
posted @ 2013-03-21 21:49 Gigbit 阅读(272) 评论(0) 推荐(0) 编辑
摘要: /* Logic : Suppose if the array is sorted till index i then we can sort the arry till i+1 by inserting i+1 th element in the correct position from 0 to i+1. The position at which (i+1)th ele... 阅读全文
posted @ 2013-03-21 20:30 Gigbit 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 该算法的思想是每趟排序都使得较小的元素排到数列的前端,因此,被称为冒泡排序。 算法: 从数列的第一个元素起,比较相邻的两个元素,直到他们按如下顺序排列: a)比较相邻的两个元素,检查他们顺序是否正确( 第二个数必须比第一个数大) b)如果他们的顺序不对,则交换他俩的顺序 void BubbleSort(int *array,int number_of_elements){ ... 阅读全文
posted @ 2013-03-21 19:51 Gigbit 阅读(307) 评论(0) 推荐(0) 编辑