算法
文章平均质量分 59
yangzhenping
我坚信让我一往无前的唯一力量就是我热爱我所做的一切!
展开
-
FreeBSD中堆排序的实现heapsort
FreeBSD中堆排序的实现heapsort 源码:https://github.com/freebsd/freebsd/blob/master/lib/libc/stdlib/heapsort.c 使用文档:https://www.freebsd.org/cgi/man.cgi?query=heapsort&sektion=3&manpath=freebsd-release-po...原创 2019-12-04 19:12:36 · 642 阅读 · 0 评论 -
FreeBSD中快速排序的实现qsort
FreeBSD中快速排序的实现qsort 首先,我们来看下FreeBSD中快速排序函数qsort怎么使用。 官方给了个例子: https://www.freebsd.org/cgi/man.cgi?query=qsort&sektion=3&manpath=freebsd-release-ports #include <stdio.h> #include &l...原创 2019-12-04 19:06:51 · 499 阅读 · 0 评论 -
Group, Greedy and Lazy in Regular Expression
(…) means a group, group can have a name, form is: (?’groupname’…) or (?…)each group has a GroupID (from 1 to infinite), group 0 is the whole matched stringIf you want to reference group, you m原创 2011-06-16 16:50:00 · 1452 阅读 · 0 评论 -
合并排序
#include //this program is edited by 200624101101杨振平//this papers edited time is Nov 7th,2008//define count of array#define N 9//main functionvoid main(){ //declare MergeSort function void MergeS原创 2010-02-26 09:06:00 · 1445 阅读 · 0 评论 -
对决算法
#include "stdio.h"#include #include #include //this programs file name is Game.cpp//this program is designed by 200624101101杨振平 on NOV 21th,2008//define a mem structtypedef struct mem{ int score; c原创 2010-02-26 09:15:00 · 1373 阅读 · 0 评论 -
快速排序
#include //this program is edited by 200624101101杨振平//this papers edited time is Nov 7th,2008//define count of array#define N 9//main functionvoid main(){ //declare QuickSort function void QuickS原创 2010-02-26 09:08:00 · 1290 阅读 · 0 评论 -
BF算法
//200624101101杨振平#include //全局变量计算比较次数int count=0;//主函数void main(){ //声明BF算法的函数原型 int BF(char S[],int n,char T[],int m); //初始化主串 char S[14]="ababcabcacbab"; printf("主串:%s/n",S); //初始化子串 char T[6]="abc原创 2010-02-26 09:01:00 · 1906 阅读 · 0 评论 -
二分覆盖
#include #include #include #include #include using namespace std; //this programs file name is coin.cpp//this program is designed by 200624101101杨振平 on NOV 22th,2008//the algorithm of divide原创 2010-02-26 09:13:00 · 1681 阅读 · 0 评论 -
农民过河问题
#include #include #include //this program is edited by 200624101101杨振平//this papers edited time is DEC 5th,2008#define MAX_STEP 20 //index: 0 - 狼,1-羊,2-菜,3-农夫,value:0-本岸,1-对岸 int a[MAX_STEP][4原创 2010-02-26 09:11:00 · 2367 阅读 · 1 评论 -
动态规划
//dynamic programming to seek shortest route#include //this program is edited by 200624101101杨振平//this papers edited time is DEC 3th,2008//define the count of nodes less 1#define N 15//define a con原创 2010-02-26 09:09:00 · 1381 阅读 · 0 评论 -
分治法
#include // find the max value between a[m] and a[n]int getmax(int a[],int m, int n) { int middle,max1,max2,max; if( m==n ) max =a[m]; else if(m == n-1) { if( a[m] > a[n])原创 2010-02-26 09:05:00 · 1505 阅读 · 0 评论 -
蛮力法
#include #include //200624101101杨振平//2008年11月4日21:43编写//the algorithm of the force methodvoid main(){ //the defination of printing menu function int menu(); //the defination of Algorithm of double m原创 2010-02-26 09:04:00 · 1495 阅读 · 0 评论 -
KMP算法
//200624101101杨振平#include //全局变量计算比较次数int count=0;void main(){ //声明KMP算法的函数原型 int KMP(char S[],int n,char T[],int m); //初始化主串 char S[14]="ababcabcacbab"; printf("主串:%s/n",S); //初始化子串 char T[6]="abca原创 2010-02-26 09:02:00 · 1500 阅读 · 0 评论