递归算法
BrightPi
这个作者很懒,什么都没留下…
展开
-
factorial
/* * szlFactorial.h */ #ifndef SZL_FACTORIAL_H #define SZL_FACTORIAL_H int factorial(int ); #endif /* * szlFactorial.c */ #include "szlFactorial.h" #include int factorial(int v){原创 2012-12-12 19:40:13 · 461 阅读 · 0 评论 -
fullpermutation
/* * szlFullPermutation.h */ #ifndef SZL_FULLPERMUTATION_H#define SZL_FULLPERMUTATION_H typedef char* STR; typedef char** PSTR; void fullPermutation(PSTR, STR ); void permutation(PSTR, STR,原创 2012-12-12 19:38:05 · 726 阅读 · 0 评论 -
台阶问题
有一个100个台阶的阶梯,一次可以选择上一个台阶,或者两个台阶,最后上到楼梯顶有几种走法?很明显的递归方程:f(n)=f(n-1)+f(n-2),f(1)=1,f(2)=2.求f(100)./*file: refibnacii.c*//* input one number between 1 and 100, print the output of the result *//*原创 2013-08-20 16:41:57 · 789 阅读 · 0 评论 -
求无序数组的中位数
原文地址:http://blog.csdn.net/zdl1016/article/details/4676882中位数即是排过序后的处于数组最中间的元素。 不考虑数组长度为偶数的情况。设集合元素个数为n。简单的想了下:思路1) 把无序数组排好序,取出中间的元素 时间复杂度 采用普通的比较排序法 O(N*logN) 如果采用非转载 2013-08-24 14:32:52 · 1098 阅读 · 0 评论