public void InsertHead(T data) { if (HEAD.Next != null) { SNode <T> newNode = new SNode <T>(data, HEAD.Next); HEAD.Next = newNode; } else { HEAD.Next = new SNode <T>(data); } }
public void Append(T data) { SNode <T> newNode = new SNode <T>(data); if (ListIsEmpty()) { HEAD.Next = newNode; } else { SNode <T> temp = HEAD.Next; while (temp.Next != null) { temp = temp.Next; } temp.Next = newNode; } }
public SNode(T data, SNode <T> next) { Next = next; Data = data; }
public SNode() { Data = default(T); Next = null; }
public SinglyLinkedList() { HEAD = new SNode <T>(); }