//获取指定位置的节点
private Node GetNodeByIndex(int index)
{
Node go = this._head;
int i = 0;
while (go != null && i < index)
{
go = go.next;
i++;
}
if(i != index) go = null;
return go;
}
因为是链式结构,不能像数组那样直接下标获取元素了,只能遍历整个链表,一个一个元素往下,知道指定的位置。