public void Clear() { Head = null; //while (Head != null) //{ // Head = Head.Next; //} cnt = 0; }
public void Print() { queueNode <T> tempNode = Head; while (tempNode != null) { Console.WriteLine(tempNode.data); tempNode = tempNode.Next; } }
public queueNode <T> Dequeue() { if (Head == null) { return(null); } queueNode <T> DeqNode = Head; Head = Head.Next; cnt--; return(DeqNode); }
public bool Contains(T Data) { bool result = false; queueNode <T> tempNode = Head; while (tempNode != null) { if (Compare(Data, tempNode.data)) { result = true; break; } else { tempNode = tempNode.Next; } } return(result); }
public void Enqueue(T a_data) { if (Head == null) { this.Head = new queueNode <T>(); this.Head.data = a_data; this.Head.Next = null; Tail = Head; } else { queueNode <T> newNode = new queueNode <T>(); newNode.data = a_data; Tail.Next = newNode; Tail = newNode; //if (Last != null) Last = tempNode; } cnt++; }