static void Display(MyCircularQueue q) { Console.WriteLine($"items: {string.Join(',', q._queue)}"); Console.WriteLine($"front/read : {q.Front()}, {q.Rear()}"); Console.WriteLine($"empty/full : {q.IsEmpty()}, {q.IsFull()}"); Console.WriteLine("- - -"); }
public static void Run() { var q = new MyCircularQueue(3); Display(q); q.EnQueue(1); Display(q); q.EnQueue(2); Display(q); q.EnQueue(3); Display(q); q.DeQueue(); Display(q); q.EnQueue(9); Display(q); q.DeQueue(); Display(q); q.DeQueue(); Display(q); q.DeQueue(); Display(q); Console.ReadKey(); }