求最长公共子子序列

#include <iostream>#include <string>using namespace std;//主函数int main(){ int m,n; char *x,*y; int **b,**c; void LCSLength(int m,int n,char *y,char *x,int **c,int **b); void LCS(int i,int j,char *x,int**b); cout<<"请输入两个序列的长度:"<<endl; cin>>m>>n; x=new char[m]; y=new char[n]; cout<<"请输入两个序列:"<<endl;...
2011-12-17 22:16 | 阅读 910 次 | 评论 0 条

二分搜索排序法

#include<iostream>using namespace std;int BinarySeach(int a[],int&amp; x,int n){int left=0;int right=n-1;while(left<=right){int middle=(left+right)/2;if(x==a[middle])return middle;if(x>a[middle])left=middle+1;else right=middle-1;}return -1;}int main(){cout<<"请输入数字个数,小于50个:"<<endl;int n; while(cin...
2011-12-17 22:14 | 阅读 741 次 | 评论 0 条

用c语言编写的简单图形输出

1:#include<iostream> using namespace std; int main() { int i,j,k,n; cout<<"请输入n的值:"; cin>>n; for (i=1;i<=n;i++) { if (i<=n/2) { for (j=1;j<=n/2+1-i;j++) cout<<" "; for (k=1;k<=2*i-1;k++) cout<<"*"; cout<<endl; } else { for (j=1;j<=i-n/2-1;j++) cout<<" "; for (k=1;k<=(2*(n...
2011-07-01 14:40 | 阅读 1403 次 | 评论 0 条