public void Enqueue(T element) { var node = new MyLinkQueueNode <T> { Data = element }; Rear.Next = node; Rear = node; }
public T Dequeue() { if (Front == Rear) { throw new InvalidOperationException("队列为空,出队失败。"); } var p = Front.Next; var data = p.Data; Front.Next = p.Next; if (Rear == p) { Rear = Front; } return(data); }
public MyLinkQueue() { Front = new MyLinkQueueNode <T>(); Rear = Front; }