![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
文章平均质量分 58
putaoxiangqi
这个作者很懒,什么都没留下…
展开
-
stl学习一
stl概括 基础函数: size() 容器元素的数目 swap() begin() 第一个元素的迭代器 end() 最后一个元素的迭代器+1 X::iterator iter; 迭代器(相当于指针) seq.front() 第一个元素 seq.back() 最后一个元素 高级函数: seq.push_bac原创 2015-05-26 20:23:14 · 335 阅读 · 0 评论 -
C++面向对象编程
1.oop: 数据抽象 (类实现) 继承 (类派生实现) 动态绑定 (虚函数,基类指针调用虚函数) 继承中的内存分配: 基类保存自己的数据结构, 派生类保存基类+自己的数据结构。 虚函数一直保存在基类中。 例如: class A{ public : int a; virtual print()原创 2015-09-03 11:12:27 · 273 阅读 · 0 评论 -
c++类实现2叉树的抽象数据结构
#include #include #include using namespace std; typedef struct linknode { int data; struct linknode *left; struct linknode * right; }*ptree,tree; class BITREE{ public: BITREE(){} ~原创 2015-08-05 19:46:56 · 527 阅读 · 0 评论 -
循环队列的c++类
//----------------------- //循环链表的难点在于判断队列的空/满状态 //空:_queue->front==_queue->rear //满:_queue->front==(_queue->rear+1)%_queue->maxsize (为了区别于空的状态,此时队列还剩一个位置没有存数据) //--------------------------- #原创 2015-08-05 13:21:03 · 398 阅读 · 0 评论 -
c++实现链表的抽象数据结构
#include #include using namespace std; static const int arr[]={11,2,31,4}; static const int length=sizeof(arr)/sizeof(int); typedef struct listnode{ int data; struct listnode * next; }原创 2015-08-04 20:13:52 · 715 阅读 · 0 评论 -
c++之string类编写
#include #include using namespace std; class String{ public: String(const char *str = NULL ); //构造函数 String(const String &other); //复制构造函数 ~String(void);原创 2015-07-30 15:48:12 · 356 阅读 · 0 评论 -
c++类实现字符串的基本函数
//-------------------------------------------------------- //date:2015/08/11/20:12 //author: fangchang //包括读写,复制,连接,比较等函数 //字符串的惯用话(寻找\0的地址 复制 ) //itoa考虑是否为负数,考虑进制(比较烦,8进制的首位是0,16进制是0X) //------------原创 2015-08-11 20:15:42 · 267 阅读 · 0 评论 -
C++类实现hash表的抽象数据结构(链式解决冲突)
//-------------------------------------------------------------------------- //本例中采用链式解决冲突,便于查找 //hash表适合存储和查找操作 //构建hash要尽量减少冲突,hash表空间开的大一点,用空间换时间 //hash表的一种变种是位图表,stl中的bitmap<>,多用于大数据查找问题 //-------原创 2015-08-11 16:01:28 · 369 阅读 · 0 评论 -
c++类实现二叉查找树的抽象数据结构
说明:1.0 二叉查找树可以看成是改进的二分查找法: 不需要依赖有序的数组1.1 对于二叉查找树的前缀/后缀的查找,可能需要改变二叉树的类型,增加parent指针1.2 对于插入/删除/查找(二分,最值之类)的操作,不需要考虑parent指针的问题1.3 二叉查找树的平衡度可能很差,可能的解决办法:1.随机读取数组中的数据; 2.重新构建一颗AVL树#ifndef BINARYTREE_H原创 2015-08-07 19:27:44 · 331 阅读 · 0 评论 -
c++类实现二分查找+二叉树查找
//--------------------------------------------------- //1.二分查找树: 二分查找法对于有序的数组有效(数组+有序) //2.AVL树: 二分查找法的优化是使用二叉查找树,最好是AVL树 //--------------------------------------------------- #ifndef SEARCH_H #d原创 2015-08-07 19:31:27 · 477 阅读 · 0 评论 -
c++类实现基本的6种排序算法
#include using namespace std; class SORT{ public: SORT(){}; ~SORT(){}; void print(int arr[],int size) const; void quickSort(int arr[], int left, int right) const ; //快排 void bubble(int arr[],原创 2015-08-06 19:16:39 · 532 阅读 · 0 评论