/// <summary> /// Get the first element at the top of the stack. /// </summary> public T Peek() { if (Top == null) { return(default(T)); } else { return(Top.GetData()); } }
public T Peek() { if (Front == null) { return(default(T)); } else { return(Back.GetData()); } }
/// <summary> /// Take an element off the top of the Stack. /// </summary> public T Pop() { if (Top == null) { return(default(T)); } else { SGLNode <T> Temporary = Top; Top = Top.GetNext(); Size = Size - 1; return(Temporary.GetData()); } }
/// <summary> /// Used take out the front element of the Queue. /// </summary> public T Dequeue() { if (Front == null || Back == null) { return(default(T)); } else { SGLNode <T> Temporary = Front; Front = Front.GetNext(); Size = Size - 1; return(Temporary.GetData()); } }