![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
文章平均质量分 76
normol
先做人,后做事。
展开
-
类模板的简单例子(作业)
#includeusing namespace std;templateclass shuju{public: T data; shuju *next;};templateclass que{public: void insert(T); void print(); void goout(int n);private: shuju *first; int len;原创 2016-04-26 15:25:08 · 1901 阅读 · 0 评论 -
HDJacm 1282 回文数猜想
#includeusing namespace std;int reverse(int num){ int temp=0; while (num){ temp += num % 10; if (num/10) temp = temp * 10; num = num/10; } return temp;}int main(){ int count,k; long原创 2016-10-01 15:25:46 · 661 阅读 · 0 评论 -
HDJacm 1276士兵队列的训练问题 错误总结
#includeusing namespace std;int main(){ int person[5005]={0}; int n; cin >> n; while (n--){ int num,numtemp,i; cin >> num; numtemp = num; for ( i = 0; i < num; i++){ person[i] = i原创 2016-10-01 14:29:05 · 370 阅读 · 0 评论 -
简易版二叉查找树(查找,插入,遍历,删除)
struct TreeNode{ int data; TreeNode* lchild, *rchild;};TreeNode * search(TreeNode * &root, int key){ TreeNode *p,*s; s=p = root; while (p){ s = p; cout data << endl; if (p->data == key)原创 2016-11-05 12:27:08 · 334 阅读 · 0 评论 -
kmp算法实现字符串匹配
今天晚上知道了这个算法,看了后凭记忆理解自己又写了一遍,日后会加上注释和思路原创 2016-10-24 23:51:22 · 526 阅读 · 0 评论 -
按前序与中序遍历将二叉树线索化并输出
typedef struct BiTNode{ char data; BiTNode* lchild, *rchild; int lflag, rflag;}BiTree;//中序线索化void InThreading(BiTree* t){ if (t != NULL) { InThreading(t->lchild);//找到属于叶节点的左孩子 if (t->原创 2016-11-03 18:05:20 · 2197 阅读 · 0 评论 -
二叉树的建立(多种方法)
非递归实现typedef struct BiTNode{ char data; BiTNode* lchild, *rchild;}BiTree;//非递归实现二叉树的建立BiTree* BiTreeCreate(){ BiTree* Q[100]; char ch; int front, rear; BiTree* s, *root; root = NULL; fro原创 2016-11-03 15:03:54 · 6904 阅读 · 0 评论 -
HDOJ acm 1022 火车进站出站(栈系列)
#include#include#includeusing namespace std;int main(){ int n; while (cin >> n) { bool flag = false; char* pin = new char[5*n]; char* pout = new char[5*n]; int* data = new int[5*n];原创 2016-10-10 20:41:53 · 2159 阅读 · 0 评论 -
学生管理系统map实现篇
//student.h#ifndef student_h#define student_h#include#includeusing namespace std;class student{private: string name; string sex;public: friend ostream& operator<<(ostream& cout,student &s原创 2016-04-21 19:08:38 · 1462 阅读 · 0 评论 -
广义表的简单运用实例(导师制)--广义表的建立和输出
//head.htypedef struct GLNode{ char name[100]; char prof[100]; int type; struct { /*理解:hp是同级关系,tp是上下级关系*/ struct GLNode* hp, *tp; }ptr;}GList;//test.cpp#include"head.h"#include#inc原创 2016-11-10 21:49:31 · 2851 阅读 · 0 评论