文章分类 -  基础算法

摘要:/********************************** 求数组中连续字串的最大和 并返回起始位置和终止位置***********************************/#include #define elemType intelemType max(elemT... 阅读全文
posted @ 2014-06-25 19:07 枫睿 阅读(234) 评论(0) 推荐(0)
摘要:#include #include //Binary Search//递归版int rBinarySearch(int a[],int left,int right,int k) { if(a==NULL) { printf("请检查输入!\n"); return ... 阅读全文
posted @ 2014-06-05 10:31 枫睿 阅读(181) 评论(0) 推荐(0)
摘要:1 def reverseString(str,n):2 """Reverse the String"""3 if n<len(str)-1:4 reverseString(str,n+1);5 print ('%c' % (str[n])), 阅读全文
posted @ 2014-05-27 22:38 枫睿 阅读(68) 评论(0) 推荐(0)
摘要:1 #include 2 //quickSort 3 int partition(int a[],int start,int end) { 4 int node = a[start]; //初始节点 5 while(start= node && end > start) ... 阅读全文
posted @ 2014-05-22 12:50 枫睿 阅读(94) 评论(0) 推荐(0)
摘要:/× 采用递归算法,每次将第一个位置的字符与后面的字符进行交换,然后得到后面n-1个元素的全排列×/ 1 #include 2 3 //字符串的全排列 4 5 void permutation(char *pStr,char *pbegain) { 6 if(pStr==NULL) r... 阅读全文
posted @ 2014-05-22 12:49 枫睿 阅读(125) 评论(0) 推荐(0)