Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the u ...
分类:
其他好文 时间:
2016-10-26 09:35:02
阅读次数:
190
STL_算法_填充新值
fill(b, e, v)
fill(b, n, v)
generate(b, n, p)
generate_n(b, n, p)
#include
#include
#include
#include
//
#include
using namespace std;
int main()
{
list slist;
slist.push_ba...
分类:
编程语言 时间:
2016-08-21 22:56:11
阅读次数:
462
1.
容器如vector、deque、list是线性存储的,它们都是有迭代器的。
queue和stack作为容器适配器,没有迭代器的。它们默认使用deque作为底层元素。
2.
heap不属于STL容器,但是它是优先队列的幕后英雄。heap底层是vector或者array实现的。STL实现了最大堆,这样可以满足优先队列的特性。
优先队列也是容器适配器。
3.
slist是单向列表,它...
分类:
其他好文 时间:
2016-08-14 17:55:26
阅读次数:
161
单向链表每个节点由两个成员组成:一个是数据域,一个是指向自身结构的指针类型成员。如: struct slist { int data; struct slist *next; }; typedef struct slist SLIST; 单向链表的基本算法包括:链表的建立、节点数据域的输出、节点的插 ...
分类:
其他好文 时间:
2016-05-29 12:11:22
阅读次数:
171
链表结构: SList.h SList.cpp Test.cpp 2016-04-13 08:13:13 ...
分类:
编程语言 时间:
2016-04-13 08:37:57
阅读次数:
170
链表结构:SList.h#pragmaonce
typedefintDataType;
typedefstructSListNode
{
DataTypedata;
structSListNode*next;
}SListNode;
//如果要修改链表就必须加引用
SListNode*_BuyNode(DataTypex);//建立节点
voidPrintSlist(SListNode*pHead);//打印单链表
voidPushBack(SL..
分类:
编程语言 时间:
2016-04-10 19:44:20
阅读次数:
209
由于类模板不支持分离编译,我们可以将模板类成员函数的声明和定义放在一个.hpp的文件中SList.hpp#pragmaonce
#include<iostream>
usingnamespacestd;
#include<assert.h>
template<classT>
structLinkNode//节点类(建议写法)
{
LinkNode(constTx);
T_d..
分类:
其他好文 时间:
2016-04-01 16:19:00
阅读次数:
352
单链表的结构有多种这里介绍的链表有头结点、有尾节点并且尾节点指向头结点#include<iostream>
usingnamespacestd;
#include<assert.h>
typedefintDataType;
structLinkNode
{
friendclassSList;//将SList设为友元,便于SList类可以访问节点类的私有成员
public..
分类:
编程语言 时间:
2016-03-20 02:20:11
阅读次数:
270
#define_CRT_SECURE_NO_WARNINGS1
#include<iostream>
usingnamespacestd;
#include<assert.h>
typedefintDataType;
classSeqList
{
public:
SeqList()
:_array(NULL)
,_size(0)
,_capicity(0)
{}
SeqList(constSeqList&sList)
:_array(newDataType[sList._..
分类:
编程语言 时间:
2016-03-18 02:01:15
阅读次数:
302