C算法(第一卷 基础,数据结构 排序和搜索)(第三版)
文章平均质量分 74
YI一一一YI
闲来无数,务求探索
展开
-
连通性问题(connectivity)
参考:Robert Sedgewick,《算法:C语言实现》第1章 问题描述 假设给定整数对的一个序列,其中每个整数表示某类型的一个对象,我们想要说明整数对p-q表示“p连接到q”。假设“连通”关系是可传递的:也就是说如果p和q之间连通,q和r之间连通,那么p和r也是连通的。我们的目标是写一个过滤集合中的无关对的程序。程序的输入为整数对p-q,如果已经看到的数对中并转载 2017-08-23 15:45:38 · 2809 阅读 · 0 评论 -
关于巴比伦算法的 三个程序
分析: //巴比伦algorithm #include #include #define true 1 #define false 0 int main(int argc, char **argv) { int n = 0; scanf("%d", &n); double guess = n / 2; double tmp翻译 2017-10-25 10:15:35 · 1124 阅读 · 0 评论 -
简单算法
1,冒泡#include <stdio.h> int main() { int array[7] = { 2,5,3,1,6,9,7 }; int i, j; int temp = 0; for (i = 0; i < 7; i++) { for (j = 1; j < 7 - i; j++) { if (array[j-1] > array[j]...原创 2018-04-19 10:21:16 · 137 阅读 · 0 评论