原创 算法導論代碼 第10章 基本數據結構

第10章 基本數據結構 10.1 棧和隊列 10.1.1 棧 10.1.1.1 基於數組實現 #include <stdio.h> #include <stdbool.h> #include <stdlib.h> typedef stru

原创 算法導論代碼 第24章 單源最源路徑

第24章 單源最源路徑 24.1 Bellman-Ford算法 #include <stdio.h> #include <stdbool.h> #include <limits.h> #include <stdlib.h> #includ

原创 算法導論代碼 第25章 每對頂點間的最短路徑

第25章 每對頂點間的最短路徑 25.1 最短路徑與矩陣乘法 #include <stdio.h> #include <limits.h> #include <string.h> #include <stdlib.h> typedef

原创 Unix網絡編程代碼 第8章 基本UDP套接字編程

第8章 基本UDP套接字編程 8.3 UDP回射服務器程序 #include <netinet/in.h> /* sockaddr_in{} and other Internet defns */ #include <strings.h>

原创 Unix網絡編程代碼 第6章 I/O複用:select、poll和epoll函數

第6章 I/O複用:select、poll和epoll函數 6.4 str_cli函數(修訂版) //使用select #define _POSIX_SOURCE #include <netinet/in.h> /* sockaddr_i

原创 fedora 20下安裝vim的C++補全插件clang_complete

1.安裝clang yum install clang 2.安裝clang_complete插件 git clone https://github.com/Rip-Rip/clang_complete cd clang_complete

原创 算法導論代碼 第21章 用於不相交集合的數據結構

第21章 用於不相交集合的數據結構 21.2 不相交集體的鏈表表示 #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct set_type *s

原创 算法導論代碼 第8章 線性時間排序

第8章 線性時間排序 8.2 計數排序 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> void counting_sort(in

原创 算法導論代碼 第22章 圖的基本算法

第22章 圖的基本算法 22.1 圖的表示 22.1.1 鄰接表表示法 #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct graph_typ

原创 算法導論代碼 第13章 紅黑樹

#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct red_black_tree_type *tree; enum color_enum {

原创 算法導論代碼 第18章 B樹

第18章 B樹 #include <stdio.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> #include <time.h> /*兩個約定:(1)B樹的

原创 算法導論代碼 第16章 貪心算法

第16章 貪心算法 16.1 活動選擇問題 #include <stdio.h> void recursive_activity_select(int s[], int f[], int i, int j, int sel

原创 Unix網絡編程代碼 第5章 TCP客戶/服務器程序示例

第3章 套接字編程簡介 3.4 字節排序函數 #include <stdio.h> #include <stdlib.h> #define CPU_VENDOR_OS "i686-pc-linux-gnu" int main(int

原创 算法導論代碼 第20章 斐波那契堆

第20章 斐波那契堆 #include <stdio.h> #include <limits.h> #include <string.h> #include <stdbool.h> #include <math.h> #include <

原创 算法導論代碼 第19章 二項堆

第19章 二項堆 #include <stdio.h> #include <limits.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> typedef st