(一)模板实现栈#pragmaonce
typedefunsignedintsize_t;
template<classT>
classStack
{
public:
Stack()
:_array(NULL)
,_top(-1)
,_capacity(0)
{}
~Stack()
{
if(_array)
{
delete[]_array;
}
}
public:
voidPush(constT&num)
{
_CheckCapacity();
_array[++_top..
分类:
其他好文 时间:
2016-04-10 19:45:48
阅读次数:
159
template<classT,intDEFAULT_CAPACITY=0>
classStack
{
public:
Stack();
Stack(constStack<T>&st);
Stack&operator=(constStack<T>&st);
~Stack();
public:
voidPush(constT&data);
voidPop();
T&Top();
T&End();
boolEmp..
分类:
其他好文 时间:
2016-04-09 17:07:15
阅读次数:
102
ElasticSearch报以下错误的解决办法: "type": "es_rejected_execution_exception", "reason": "rejected execution of org.elasticsearch.transport.TransportService$4@1f ...
分类:
其他好文 时间:
2016-04-08 19:48:23
阅读次数:
1278
04-04 16:55:57.099 28015-28195/com.rockylearnstorock.testcamera D/MediaHelper: {csd-1=java.nio.ByteArrayBuffer[position=0,limit=8,capacity=8], mime=vi ...
分类:
移动开发 时间:
2016-04-05 09:27:16
阅读次数:
659
The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should do ...
分类:
其他好文 时间:
2016-04-04 17:47:32
阅读次数:
175
可以实现快速定位查找数据思想一:开一个适当大小的数组,讲需要存入的数据%上数组的_capacity的到的数作为他存放的位置,如果这个位置被占了,则在他的下一个位置存放数据(不会找不到空位置,下面会说到)。思想二:存放在数组上的是一个结构体,结构体包含一个索引值Key,存..
分类:
其他好文 时间:
2016-04-04 07:00:21
阅读次数:
241
seqlist.h #pragma once #define _SEQ_LIST_ #ifdef _SEQ_LIST_ #include<stdio.h> #include<assert.h> #include<string.h> #define DEFAULT_CAPACITY 3 typedef ...
分类:
其他好文 时间:
2016-04-02 17:26:30
阅读次数:
264
#include<iostream>
usingnamespacestd;
structstack
{
int*_pElem;//指向元素数据的指针
int_capacity;
int_top;
stack(intn)
:_capacity(n)
{
_top=0;
_pElem=newint[_capacity];
}
~stack()
{
delete[]_pElem;
_pElem=NULL;
}
};
classStack
{
private:
stacks;
s..
分类:
其他好文 时间:
2016-04-01 06:42:13
阅读次数:
145
c++引入模板是为了更好的代码复用,模板这边分为两个大块.1.模板函数2.模板类我们今天来介绍模板类的应用—顺序表和链表(单链表为例)//模板的顺序表
template<classT>
classSeqList
{
public:
SeqList()
:_array(NULL)
,_size(0)
,_capacity(0)
{}
~SeqList..
分类:
其他好文 时间:
2016-03-31 15:03:29
阅读次数:
185
/************************************
WZASUST2016
顺序表第二个模板
************************************/
#include"wz.h"
#include"sts.h"
template<typenameT>
classseqlist
{
public:
seqlist()
:_data(NULL)
,_size(0)
,_capacity(0)
{
CheckCapacity();
}
/*..
分类:
编程语言 时间:
2016-03-31 07:12:11
阅读次数:
349