#include<iostream>
#include<string>
usingnamespacestd;
template<typenameT>
structNode
{
Node(constT&d)
:_data(d)
,_next(NULL)
,_prev(NULL)
{}
T_data;
Node<T>*_next;
Node<T>*_prev;
};
template<typenameT>
classDList
{
p..
分类:
编程语言 时间:
2016-03-29 06:38:54
阅读次数:
233
1.冒泡排序:voidBubbleSort(ListNode*&pHead)//冒泡排序
{
ListNode*tail=NULL;
assert(pHead!=NULL&&pHead->_next!=NULL);
while(tail!=pHead->_next)
{
ListNode*prev=pHead;
ListNode*cur=pHead->_next;
while(cur!=tail)//单次排序
{
..
分类:
编程语言 时间:
2016-03-28 22:02:01
阅读次数:
303
linux内核链表的定义(定义了双向链表,不含数据域) 定义在 /linux-source-3.13.0/include/linux/types.h 头文件中. 1 struct list_head { 2 struct list_head *next, *prev; 3 }; 我们可以利用这个数据 ...
分类:
系统相关 时间:
2016-03-28 11:58:29
阅读次数:
281
双向链表结构图:节点结构:代码实现:/*DList.h*/
#pragmaonce
#include<iostream>
#include<cassert>
usingnamespacestd;
typedefintDataType;
structNode
{
Node(constDataType&x)
:_data(x)
,_next(NULL)
,_prev(NULL)
{}
DataType_data; //数..
分类:
编程语言 时间:
2016-03-26 20:34:12
阅读次数:
354
循环双向链表的增删查改等基本操作#include<iostream>
#include<assert.h>
usingnamespacestd;
typedefintDataType;
structListNode
{
DataType_data;
ListNode*_prev;
ListNode*_next;
ListNode(constDataType&x)
:_data(x)
,_prev(NULL)
,_next(NU..
分类:
编程语言 时间:
2016-03-24 16:41:21
阅读次数:
415
1.看源代码必须搞懂Android的数据结构。在init源代码中双向链表listnode使用非常多,它仅仅有prev和next两个指针,没有不论什么数据成员。这个和linux内核的list_head如出一辙,由此可见安卓深受linux内核的影响的。本来来分析一下这个listnode数据结构。 这里须
分类:
移动开发 时间:
2016-03-21 18:00:34
阅读次数:
186
#include<stdio.h>#define STOP '|'#include<ctype.h>int main(){ char ch; char prev; long n_chars=0L; int n_lines=0; int p_lines=0; int n_words=0; bool i
分类:
其他好文 时间:
2016-03-19 16:02:50
阅读次数:
134
双向链表#include<iostream>
usingnamespacestd;
typedefintDataType;
structNode
{
Node(constDataType&d)
:_data(d)
,_next(NULL)
,_prev(NULL)
{}
Node*_next;
Node*_prev;
DataType_data;
};
classDList
{
friendostream&operator<<(ostrea..
分类:
编程语言 时间:
2016-03-17 13:00:16
阅读次数:
217
//结构体的定义
structNode
{
Node(constDataType&d)
:_next(NULL)
,_prev(NULL)
,_data(d)
{}
public:
DataType_data;
Node*_prev;
Node*_next;
};
//双向链表类的定义
classDouList
{
friendostream&operator<<(ostream&os,DouList&l);
pu..
分类:
编程语言 时间:
2016-03-17 02:12:45
阅读次数:
356
/*
模板实现双向链表的去重、拼接、合并、排序
*/
#pragmaonce
#include<iostream>
template<classT>
structNode
{
T_data;
Node<T>*_next;
Node<T>*prev;
};
template<classT>
classSeqList
{
public:
SeqList()
:_head(NULL),
_tail(..
分类:
编程语言 时间:
2016-03-15 06:24:18
阅读次数:
209