1, n vertices, M-bar full-connected graph, at least remove the ____ edge to form a tree? M-n+1
2, the realization of two n*n matrix multiplication, the matrix is represented by a one-dimensional array.
First Look at addition:
void Add (int rows, int cols) {for (Int. i= 0;i<rows;i++) {for (int j=0;j<cols;j++) Result[i] [J]=mat1[i][j]+mat2[i][j]; }
Multiplication
#include <iostream>using namespace std; #define SIZE 2 int multi (int *a, int *b, int N) {int I, j, K, temp; int *c = (int*) malloc (n * n * sizeof (int));
for (i = 0, i < n; i++) {for (j = 0; J < N; J + +) {
temp = i * N + j; * (c + temp) = 0; for (k = 0; k < N; k++) {* (c + temp) + = A[i * n + K] * b[k * n + j]; }
cout<<* (c + temp) << ""; }
} return *c;} int main () {int a[size * size] = {2, 1, 4, 3}; int b[size * Size] = {1,-1, 3, 2}; multi (A, B, size); return 0;}
A summary of the questions in C + +