Queue
A Queue Data Structure is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of “First in, First out” (FIFO), where the first element added to the queue is the first one to be removed. Queues are commonly used in various algorithms and applications for their simplicity and efficiency in managing data flow.
Ultify's queue is implemented using Linked List so both time complexity of
enqueue
and dequeue
is .
Operations
- Enqueue (Insert): Adds an element to the rear of the queue.
- Dequeue (Delete): Removes and returns the element from the front of the queue.
- Peek: Returns the element at the front of the queue without removing it.
- Clear: Empty the queue.
- IsEmpty: Checks if the queue is empty.
- toArray: Convert a queue to an array.