Chapter 8 · SimulationDeque Simulator ? ← Chapter 8 Value Capacity Add First Add Last Remove First Remove Last Peek First Peek Last Search Traverse Example Random Clear Cancel FRONT REAR Ready. Close Deque Simulator A deque (double-ended queue) lets you insert and remove at both the front and the rear. Use one end only and it behaves as a stack; add at one end and remove at the other and it behaves as a queue. How to use it Add First / Add Last insert the value; Remove First / Remove Last take the element off that end; Peek First / Peek Last read it without removing it. Capacity (1–8) limits the size; inserting into a full deque is an overflow. Search and Traverse scan from front to rear; Example and Random fill the deque with sample values; Clear empties it; Cancel stops the animation. Costs OperationTime Insert / remove / peek at either endO(1) Search, traversalO(n) Typical uses: sliding-window maximum, palindrome checking, work-stealing schedulers.