The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly. A programmer is ideally an essayist who works with traditional aesthetic and literary forms as well as mathematical concepts, to communicate the way that an algorithm works and to convince a reader that the results will be correct. ― Donald E. Knuth

# Algorithms

## Stacks & Queues

Problem :-
Implement a queue using an array. Write the following functions :
enqueue ( int ) to insert an element at the rear end of the queue.
dequeue ( ) to remove the an element from the front end of the queue.
display ( ) to display all the elements of queue.

Solution :-
We will use an array of fixed size and maintain two variables front ( stores the index of the front element of the queue ) and rear ( stores the index of last element in the queue ). For enqueing ( inserting ) an element, we increment rear and insert the element and for dequeing ( removing ) an element, we increment front.
See the implementation below.