05 2012 档案
摘要:算法思想:从数列中找出一个元素放在最前面,然后对剩下的n-1元素进行全排列。源代码:#include <stdio.h>void output(int a[], int n){ for(int i = 0; i < n; ++ i) printf("%d", a[i]); printf("\n");}void swap(int a[], int k, int t){ int b = a[k]; a[k] = a[t]; a[t] = b;}void perml(int a[], int m, int n){ if...
阅读全文
摘要:看CSDN上有人讨论面试题,其中一题,自己动手也了一下#include <stdio.h>#define ASSERT(x) if((x)) return ;void strcpy(char* des, char* src){ ASSERT(!des || !src || !(*src)); *des = '\0'; des ++; src ++; while(*src != '\0') *(des ++) = *(src ++); *des = '\0'; src --; des --; w...
阅读全文

浙公网安备 33010602011771号