static void Main(string[] args) { int size; Console.Write("Enter the size of array deque:"); size = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(""); Console.WriteLine("Size of array stack is {0}", size); ArrayDeque deque = new ArrayDeque(size); deque.isEmpty(); deque.insertFront(51); deque.insertFront(52); deque.insertFront(53); deque.insertFront(54); deque.isEmpty(); deque.insertLast(61); deque.insertLast(62); deque.insertLast(63); deque.insertLast(64); deque.deletefirst(); deque.deleteLast(); deque.deletefirst(); deque.deleteLast(); deque.deletefirst(); deque.deleteLast(); deque.getFront(); deque.getRear(); deque.isFull(); int element; int position; Console.WriteLine(""); Console.Write("Enter the element which add in deque:"); element = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(""); Console.Write("Enter the position in which element to be add in deque:"); position = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(""); deque.add(position, element); int remove1; Console.Write("Enter the element to remove in deque:"); remove1 = Convert.ToInt16(Console.ReadLine()); deque.remove(remove1); }
public static void Test() { ArrayDeque <int> ad = new ArrayDeque <int>(4); ad.PushBack(1); ad.PushFront(90); ad.PushFront(20); Console.WriteLine(ad.PopBack()); Console.WriteLine(ad.PopBack()); Console.WriteLine(ad.PopBack()); ad.PushFront(3131); ad.PushFront(5235); ad.PushBack(75675); ad.PushFront(34534); Console.WriteLine(ad.PopFront()); Console.WriteLine(ad.PopFront()); Console.WriteLine(ad.PopBack()); Console.WriteLine(ad.PopBack()); }