对双向循环链表来说,可以在单向循环链表的基础上去做!双向循环链表中一些引用型函数(不改变链表结构)来说一般可以通过顺序和逆序两种渠道去实现,对一些基本型(改变链表的结构)函数,稍微麻烦一点的,不过如果你沿着顺序和逆序两条思路去分析的话,就不难解决(顺序由头结点的右指针域开始,逆序由头结点的左指针域开始)
</pre><pre class="html" name="code">#include<iostream>
using namespace std;
typedef int ElemType;
typedef struct Node
{
ElemType data;
struct Node *pPrior;
struct Node *pNext;
}Node,*pNode;
void InitList(pNode &pHead)
{
pHead = new Node;
pHead->pPrior = pHead;
pHead->pNext = pHead;
}
void CreateList(pNode &pHead, int count)
{
pNode pTail = pHead;
for (int i = 1; i <= count; ++i)
{
pNode pNew = new Node;
cin >> pNew->data;//数据域赋值
pNew->pPrior = pTail;//左指针域链接
pNew->pNext = pHead;//右指针域链接
pHead->pPrior = pNew;//pHead左指针域链接
pTail->pNext = pNew;//最后一个元素右指针域链接
pTail =