2011年1月27日

查找算法——二分查找

摘要: [代码]Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- 1 #include stdio.h 2 3 int main(int argc, char** argv) 4 { 5 int array[] = {1, 3, 5, 24, 35, 45, 67, 73, 76, 78, 98, 99, 200, 201, 202, 455, 3445}; 6 int length = sizeof(array)/sizeof(int); 7 in 阅读全文

posted @ 2011-01-27 11:49 leothink 阅读(218) 评论(0) 推荐(0)

排序算法——合并排序

摘要: [代码]Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- 1 #include stdlib.h 2 3 void merge2(int array[], int low, int mid, int high) 4 { 5 int i, k; 6 int *temp = (int *)malloc((high - low + 1) * sizeof(int)); 7 int begin1 = low; 8 int end1 = mid; 9 阅读全文

posted @ 2011-01-27 11:48 leothink 阅读(182) 评论(0) 推荐(0)

排序算法——选择排序

摘要: [代码]Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- 1 #include stdio.h 2 3 int main(int argc, char** argv) 4 { 5 int nums[] = {1, 423, 43,534,2,4,7,8,9,54,10,34,45}; 6 int length = sizeof(nums)/sizeof(int); 7 int i,j,min,temp; 8 9 for (i = 0; i 阅读全文

posted @ 2011-01-27 11:48 leothink 阅读(122) 评论(0) 推荐(0)

排序算法——插入排序

摘要: [代码]Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- 1 #include stdio.h 2 3 void insertion_sort(int array[], unsigned int first, unsigned int last) 4 { 5 int i, j, k; 6 int temp; 7 8 int start = first; //直接用first在内层循环会产生未知错误 9 10 for (i = start + 阅读全文

posted @ 2011-01-27 11:43 leothink 阅读(161) 评论(0) 推荐(0)

排序算法——冒泡排序

摘要: [代码]Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- 1 #include stdio.h 2 3 int main(int argc, char** argv) 4 { 5 int nums[] = {1, 423, 43,534,2,4,7,8,9,54,10,34,45}; 6 int length = sizeof(nums)/sizeof(int); 7 int i = 0, j = 0, temp = 0; 8 9 prin 阅读全文

posted @ 2011-01-27 11:36 leothink 阅读(210) 评论(0) 推荐(0)

导航