自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 输入一个字符串,求字符的所有排列

#include #include #include using namespace std;void ComStr(char *str, string &s,int m){ if (m == 0) { cout<<s<<endl; return ; } if (*str != '\0') { s.push_back(*str); ComStr(str+1,s

2014-08-12 16:07:01 639

原创 输入一个数组,判断该数组是否是某二叉树的前序遍历结果

#include using namespace std;bool verify_tree_pre(int a[],int len){ if (a==NULL || len<=0) { return false; } int root = a[0]; int i,j; for (i=1;i<len;i++) { if (a[i] > root) { break

2014-08-11 21:20:48 749

原创 用循环的方法实现二叉树的镜像

程序中包含了递归方法 和循环方法#include #include using namespace std;struct tree{ int value; tree *left; tree *right;};tree *create(){ int n; cin>>n; if (n == 0) { return NULL; } else { tree *ro

2014-08-11 16:19:33 1887

原创 旋转数组的最小数字

自己补充的整个程序,包括排序,旋转,查找#include using namespace std;void my_sort(int a[],int len){ int temp; for (int i=0;i<len-1;i++) { for (int j=0;j<len-1-i;j++) { if (a[j]>a[j+1]) { temp = a[j];

2014-08-09 09:49:27 547

转载 快速排序

#include using namespace std;void Qsort(int a[],int low,int high){if (low>=high){return;}int first = low;int last = high;int key = a[first];while (first{while (first=key){

2014-08-08 21:31:28 474 1

原创 输入某二叉树的前序和中序遍历结果,重建该二叉树

/*输入某二叉树的前序和中序遍历结果,重建该二叉树*/#include using namespace std;struct tree{int value;tree *left;tree *right;};tree *constructCore(int *s1,int *e1,int *s2,int *e2){tree *root = n

2014-08-08 17:38:44 444

原创 有两个排序数组A1和A2,内存在A1的末尾有足够多的空余空间容纳A2,实现一个函数,把A2 插入到A1,并且是有序的。

/*有两个排序数组A1和A2,内存在A1的末尾有足够多的空余空间容纳A2,实现一个函数,把A2插入到A1,并且是有序的。*/#include using namespace std;void fun(int a[],int len1,int b[],int len2){int i = len1+len2;i--;len1--;len2--;while

2014-08-08 16:02:22 3654 1

原创 请实现一个函数,把字符串中的每个空格替换成“ ”

#include #include using namespace std;void fun(char string[],int len){if(string == NULL && len return ;int count = 0;int i = 0;while (string[i]!='\0'){if (string[i] == ' '){c

2014-08-08 15:36:37 804

原创 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。 请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数

/*在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。*/#include using namespace std;bool myFind(int a[][4],int rows,int columns,int value){int row = 0;i

2014-08-08 11:41:42 2517

原创 大数相除

#include #include using namespace std;int num1[210]={0};int num2[210]={0};int ff(int num1[],int num2[],int len1,int len2){if(len1{return -1;}if(len1==len2){for(int i=len1-1;i

2014-08-06 20:39:40 582

原创 将w字符串中m个字符移动到字符串的前边,其余依次向右移动

/*将w字符串中m个字符移动到字符串的前边,其余依次向右移动*/#include #include using namespace std;void fun(char *w , int m){char p[10];strcpy(p,w);int len = strlen(w);if (m>len){m = len;}for (int i=

2014-08-04 14:51:07 887

原创 转换字符串格式为原来字符串里的字符+该字符连续出现的个数

/*转换字符串格式为原来字符串里的字符+该字符连续出现的个数*/#include #include using namespace std;int main(){string s;cin>>s;for (int i=0;i{int count = 1;int k = i;while(s[i+1]){if (s[i+1]==s[k])

2014-08-04 12:00:26 510

原创 将一句话里的单词进行倒置

/*将一句话里的单词进行倒置,标点符号不倒换。比如:i come from yantai.倒换后变为 yantai. from come i*/#include #include using namespace std;int main(){char str[100];gets(str);int len = strlen(str);int i,j;c

2014-08-04 11:30:51 871

原创 strstr()函数

/*写函数strstr(),不要使用任何C中已有的函数*/#include using namespace std;const char* strstr(const char *string,const char *strCharSet){for (int i=0;string[i]!='\0';i++){int j;int k = i;for (j=0

2014-08-04 11:00:04 430

原创 单词迷宫

//Word Maze(单词迷宫)//Word?Maze?是一个网络小游戏,你需要找到以字母标注的食物,但要求以给定单词字母的顺序吃掉。如上图,假设给定单词if,你必须先吃掉i然后才能吃掉f。//????但现在你的任务可没有这么简单,你现在处于一个迷宫Maze(n×m的矩阵)当中,里面到处都是以字母标注的食物,但你只能吃掉能连成给定单词W的食物。//如下图,指定W为“SOLO”,则在地

2014-08-04 10:12:54 1476

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除