![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法学习笔记
红鲤鱼与绿鲤鱼与驴__
记录学习过程中的点点滴滴
展开
-
数据结构-(1 1)-异常类构建
异常类构建:异常的类型可以是自定义 类类型对于 类类型异常 的匹配依旧是至上而下严格匹配赋值兼容性原则 在异常匹配中依然适用一般而言 – 匹配子类异常的 catch 放在上部 – 匹配父类异常的 catch 放在下部现代c++库必然包所依赖的异常类族异常类中的接口定义class Exception{ public: Exception(const char* mess原创 2017-04-05 21:31:52 · 265 阅读 · 0 评论 -
单链表(带表头)
链表的创建插入删除遍历逆序等操作//链表节点创建typedef struct Node{ int data; //数据域 struct Node *Next;//指针域}NODE, *LinkList;//链表节点初始化data为-1NODE *ListInit(){ NODE *pNode; pNode = (NODE*)...原创 2017-09-07 14:13:27 · 552 阅读 · 2 评论 -
hashmap工作原理等
http://www.importnew.com/7099.html http://blog.csdn.net/paincupid/article/details/47711351原创 2017-09-12 14:26:00 · 212 阅读 · 0 评论 -
排序算法模版实现
0、涉及到的交换函数和打印函数template<typename T>void Swap(T& a,T& b){ T c = a; a = b; b = c;}template<typename T>void Print(T a[],int len){ for (int i = 0; i < len ; ++i) { cout<<a[原创 2017-11-17 21:56:11 · 241 阅读 · 0 评论 -
String字符串类实现
1、class String{public: String(const char *str = null);//普通构造函数 String(const String& other);//拷贝构造函数 ~String();//析构函数 String& operator = (const String& other);//赋值函数 ...原创 2017-11-17 22:32:08 · 479 阅读 · 0 评论 -
Singleton
http://www.cnblogs.com/loveis715/archive/2012/07/18/2598409.html#3611861原创 2017-08-29 13:48:30 · 295 阅读 · 0 评论 -
单例模式代码例子
#include <iostream>#include <string>using namespace std;class CSingleton{private: CSingleton()// 构造函数私有 { } CSingleton(const CSingleton&);//拷贝构造函数 CSingleton& operator= (const CS原创 2017-11-01 21:58:48 · 380 阅读 · 0 评论 -
字符串查找算法BF和KMP
其中,Target为主串,Pattern为子串(模式串),如果在主串Target的第pos个位置后存在与子串Pattern相同的子串,返回它在主串Target中第pos个字符后第一次出现的位置,否则返回-11、 BF算法(Brute-Force,最基本的字符串匹配算法)int BF(const string &Target,const string &Pattern,int pos) {原创 2017-11-26 17:31:04 · 317 阅读 · 0 评论 -
二分查找、折半查找、递归与非递归
1、非递归方法template <typename T>int BinarySearch(T array[],int low,int high,T key){ while(low <= high) { int mid = low + (high-low)/2; if (key < array[mid] ) high = mi原创 2017-11-26 18:02:26 · 289 阅读 · 0 评论