2013年3月13日

算法导论15.2节 矩阵链乘法

摘要: View Code #include <stdio.h>#include <string.h>#define SIZE 6typedef struct MATRIX { int row; int col;}matrix;int m[SIZE][SIZE] = {0};int s[SIZE][SIZE] = {0};void matrixChainOrder(matrix *p){ int i, j, l, k; int n = 6;//sizeof(p)/sizeof(matrix); for (i = 0; i < n; ... 阅读全文

posted @ 2013-03-13 20:29 愤怒的屎壳螂 阅读(167) 评论(0) 推荐(0) 编辑

算法导论15.1节 装配线调度问题

摘要: View Code #include <stdio.h>int l[2][6] = {0};int f[2][6] = {0};int f1, l1;int fastWay(int a[][6], int t[][5], int *e, int *x, int n) { f[0][0] = e[0] + a[0][0]; f[1][0] = e[1] + a[1][0]; int j; for (j = 1; j < n; j++) { if (f[0][j-1] + a[0][j] <= f... 阅读全文

posted @ 2013-03-13 20:22 愤怒的屎壳螂 阅读(142) 评论(0) 推荐(0) 编辑

导航