双链表有关问题 简单 在线结贴

双链表问题 简单 在线结贴
C/C++ code
//构造函数

    Node(const T& e1, Node *p = 0, Node *n = 0)
    {
        this->info = e1;
        this->prev = p;    //前驱
        this->next = n;//后继
    }
//-----------
//尾部添加元素
void DoubleList<T>::addToDoubleListTail(const T& e1)
{
    if (isEmpty())        // 如果为空链表
    {
        head = tail = new Node<T>(e1);
    }
    else
    {
    //①

        /*Node<T> *ptem;
        ptem = new Node<T>(e1, tail, 0);
        tail = tail->next;
        */
    //②

        /*tail->next = new Node<T>(e1, tail, 0);
        tail = tail->next;*/
    //③

        tail = new Node<T>(e1, tail, 0);
        tail->prev->next = tail;
    }
}


我想问这三种方法 都是插入元素都对吗?
还有就是 tail = new Node<T>(e1, tail, 0)这句的意思是不是代表 tail->prev = tail, tail->next = 0;这句??
求大神帮组

------解决方案--------------------
C/C++ code

tail->prev = tail//前驱指针指向了了自己了。
tail->next = 0//把尾部设置为NULL;
//建议在纸上画一下就明白了。

------解决方案--------------------
(tail) = new Node<T>(e1, tail, 0);调用构造函数:Node(const T& e1, Node *p = 0, Node *n = 0);
C/C++ code
        (tail)->info = e1;
        (tail)->prev = tail;    
        (tail)->next = 0;

------解决方案--------------------
看看这篇文章吧
http://www.cnblogs.com/chenyuming507950417/archive/2011/12/30/2307315.html
------解决方案--------------------
探讨
引用:

C/C++ code

tail->prev = tail//前驱指针指向了了自己了。
tail->next = 0//把尾部设置为NULL;
//建议在纸上画一下就明白了。


C/C++ code

//①

/*Node<T> *ptem;
ptem = new Node<T>(e……