- 博客(17)
- 收藏
- 关注
原创 如何用KMP字符串匹配算法求出主串中所包含模式串的总个数
如何用KMP字符串匹配算法求出主串中所包含模式串的总个数 #include<bits/stdc++.h> using namespace std; void getnext(int next[],string s,int len) { int j=0,k=-1; next[0]=-1; while(j<len){ if(k==-1||s[j...
2020-05-04 18:19:20
1156
4
原创 C++在类中实现二叉树的建立和遍历
C++在类中实现二叉树的建立和遍历 #include<bits/stdc++.h> using namespace std; typedef struct Node{ char data; struct Node *lchild; struct Node *rchild; }Node; typedef Node* node; class ...
2020-04-23 19:13:30
322
1
原创 LRU页面置换算法的实现(c++版)
#include<bits/stdc++.h> using namespace std; class LinkStack{ private: struct Node{ int elem; struct Node* next; struct Node* prev; }; struct Node* head; struct Node* tail; public: LinkStack(){ head
2020-12-08 14:05:40
1429
原创 (BY)的C++暑期小实践之期末大作业-小型浏览器的实现代码
#include<iostream> #include<cctype> #include<sstream> #include<algorithm> #include<string> #include<cstring> using namespace std; class Create; class Browser { friend ostream& operator<<(ostream& os, Brows
2020-07-15 10:05:56
2251
1
原创 自己做的一个小型异质链表加文件的读写(BY期末大作业)
#include<string> #include<iostream> #include<cstring> #include<cctype> #include<algorithm> using namespace std; class List; class Person { friend class List; protected: string name; int age; string address; string telepho
2020-07-14 11:00:34
413
3
原创 自己写的string类
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<string.h> #include<cctype> using namespace std; class String { //符号重载(通过友元函数) friend ostream& operator<<(ostream& os, String& str);//重载流插入运算符 friend istream&
2020-07-13 10:38:48
416
原创 用类去封装一个可变长数组(Vector)
#include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<cctype> #include<fstream> using namespace std; template<typename T> class Vector { private: T* p; int size; public: Vector() { s
2020-06-30 20:36:44
308
原创 Trie (字典树) 的基本操作---插入,删除,单词前缀匹配等等
#include<iostream> #include<vector> #include<algorithm> #include<cctype> using namespace std; const int R = 26; typedef struct TrieTree* Position; enum Color{red,black}; struct TrieTree { char ch; Color color;//red表示一个单词到此处结束,
2020-06-20 12:21:34
1187
原创 AVL树(平衡二叉树)的构建及其基本的插入操作
#include<iostream> #include<algorithm> #include<cctype> #include<fstream> #include<cstring> using namespace std; struct AVLTree { int data; struct AVLTree* left; struct AVLTree* right; int height; };//构建AVL树的基本
2020-06-05 21:19:41
396
原创 基于链接法的哈希表的构造
#include<iostream> #include<string> #include<cctype> #include<fstream> #include<algorithm> using namespace std; const int MaxSize = 97; typedef struct Element { int num; struct Element* next; }Element; typedef struct HashTab
2020-05-29 23:22:40
390
原创 基于开放地址法的哈希表(散列表)
#include<iostream> #include<string> #include<cctype> #include<fstream> #include<algorithm> using namespace std; const int MaxSize = 97; typedef struct Element { int info;//info的用处是用来标记元素是否被删除过 int num; }Element; typedef stru
2020-05-29 22:47:43
929
原创 基数排序(MSD)
#include<iostream> #include<string> #include<cctype> #include<fstream> #include<algorithm> using namespace std; int getnum(int tmp)//获取一个数的位数 { int count = 0; while (tmp) { count++; tmp /= 10; } return count; } int get
2020-05-29 13:46:21
1336
原创 最大堆(MaxHeap)的基本操作(建立,插入和删除)
#include<iostream> #include<vector> #include<algorithm> #include<map> #include<fstream> #include<cctype> using namespace std; const int INF = 0x3f3f3f; typedef struct Max_Heap { int* element; int capacity; int size; }
2020-05-26 19:21:18
1458
2
原创 二叉排序树的基本骚操作
二叉排序树的基本操作 #include<bits/stdc++.h> using namespace std; struct BiTree{ int data; struct BiTree *lchild,*rchild; }; typedef BiTree* node; node search(int T,node root)//二叉排序树的搜索 { nod...
2020-05-08 11:47:16
189
1
原创 一元多项式的相关运算
链表实现一元多项式的加法和乘法 #include<bits/stdc++.h> using namespace std; typedef struct Node{ int ceof; int exp; struct Node* next; }Node; Node *read(string s) { Node *head,*middle,*near; ...
2020-05-06 23:31:39
246
2
原创 尝试用类封装了一下大数加法(高精度运算)
类的封装很有趣不是 #include<bits/stdc++.h> using namespace std; class BigInteger{ private: char str[10050]; int num[10050]={0}; public: BigInteger(){} ~BigInteger(){} BigInteger(char ...
2020-04-24 09:59:23
326
1
原创 二叉树的建立(已知前序序列和中序序列)
已知二叉树前序序列和中序序列递归创建二叉树 #include<bits/stdc++.h> using namespace std; typedef struct Node{ char data; struct Node *lchild; struct Node *rchild; }Node; typedef Node* node; No...
2020-04-23 19:45:41
355
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅