How would i change this to were it puts the elements in priority order? with the highest priority at the front. Thanx.
void ENQUEUE(queue *Q,ElementType X)
/* insert the element X at the front of queue Q */
{
if Q->size == max_size /*check the array is full */
ERROR("array is full"); /* print warning message */
else
{ /*insert the element at the front of the queue */
Q->rear = (Q->rear + 1)%max_size; /*move rear 1 clockwise*/
Q->entry[Q->rear] = X; /*insert element at rear*/
Q->size ++;
}
}