#include<iostream> #include<algorithm> #include<cstring>#include<string.h> using namespace std; #include<assert.h> //反转区间 void Reverse(char* pBegin , ...
分类:
编程语言 时间:
2016-04-27 22:31:57
阅读次数:
430
二叉树:二叉树是一棵特殊的树,二叉树每个节点最多有两个孩子结点,分别称为左孩子和右孩子。#define_CRT_SECURE_NO_WARNINGS1#include<iostream>
#include<assert.h>
#include<stack>
#include<queue>usingnamespacestd;
//节点结构
template<clas..
分类:
其他好文 时间:
2016-04-27 19:03:00
阅读次数:
236
建立PriorityQueue.hpp:#define_CRT_SECURE_NO_WARNINGS1
#include<iostream>
usingnamespacestd;
#include<assert.h>
#include<vector>
template<classT>
structLess
{
booloperator()(constT&l,constT&r)
{
returnl<r;
}
};
template..
分类:
其他好文 时间:
2016-04-27 07:09:59
阅读次数:
181
实现动态顺序表SeqList.h#pragmaonce
#include<stdio.h>
#include<string.h>
#include<assert.h>
#include<malloc.h>
typedefintDataType;
typedefstructSeqList
{
DataType*arry;
size_tsize;
size_tcapacity;
}SeqList;
voidcheck(SeqList*Seq);//..
分类:
其他好文 时间:
2016-04-27 07:03:39
阅读次数:
229
其中包括广义表的创建、输出、拷贝构造、赋值运算符重载、析构、有效数据个数以及广义表深度
#pragmaonce
#include<iostream>
#include<assert.h>
#include<ctype.h>
usingnamespacestd;
enumType
{
HEAD,VALUE,SUB
};//头结点、值、子表
structGeneral..
分类:
其他好文 时间:
2016-04-26 22:27:16
阅读次数:
430
auto,decltype,for,nullptr如果编译器在定义一个变量的时候可以推断出变量的类型,不用写变量的类型,你只需写auto即可auto str = "sissie";
assert(typeid(str) == typeid(const char *));auto处理引用时默认是值类型,可以指定&作为修饰符强制它作为引用,auto自动获取指针类型,也可以显示地指定指针类型int& fo...
分类:
编程语言 时间:
2016-04-26 19:47:26
阅读次数:
249
栈的特点:先进后出队列特点:先进先出//实现两个栈实现一个队列
//每次都push到_s1中,pop从_s2,提高效率(每次不用互相倒栈)#pragmaonce
#include<iostream>
#include<stack>
#include<queue>
#include<assert.h>
usingnamespacestd;
template<..
分类:
其他好文 时间:
2016-04-25 19:45:04
阅读次数:
137
//快排,冒泡链表排序
#include<iostream>
#include<assert.h>
usingnamespacestd;
template<classT>
structLinkNode
{
T_data;
LinkNode*_next;
LinkNode(constT&x)
:_data(x)
,_next(NULL)
{}
};
template<classT>
classListNode
{
//..
分类:
编程语言 时间:
2016-04-25 01:12:02
阅读次数:
253
基本数据类型: 1. 程序主体中仅能出现的数字就是0和1,除此之外,所有的数字都要用宏定义或者const类型,用清晰的变量名描述用途 2. 预防除零错误, assert(denominator!=0)或者其他 3. 显式进行类型转换 4.避免不同类型间比较 5.注意编译器警告 对于整数,需要注意:整 ...
分类:
其他好文 时间:
2016-04-24 18:31:20
阅读次数:
99
对于二叉树的实现主要运用递归进行实现,代码如下:#include<assert.h>template<classT>structBinaryTreeNode{ T_data; BinaryTreeNode<T>*_left; BinaryTreeNode<T>*_right; BinaryTreeNode(constT&x) :_data(x) ,_left(NULL) ,_right(NULL) {..
分类:
其他好文 时间:
2016-04-23 23:15:16
阅读次数:
198