线性表的链式存储结构-添加元素到尾部
//向链表后面快速添加元素
public bool AddQuick(T element)
{

    Node add = new Node();
    add.data = element;
    add.next = null;

    this._last.next = add;
    this._last = add;
    this._curentLinkLength++;
    return true;

}

线性表的链式存储结构


直接使用尾部结点的引用,快速赋值next结点为新结点,再改变尾部结点为新结点。

如果没有尾部结点,则需要找到这个结点,通过遍历整个链表,直到结点的next引用为空,那么这个结点就是尾结点。


首页 我的博客
粤ICP备17103704号