how do i find the number of items in a circular queue?
|front - rear| doesnt always work.
is there one equation to know how many element is in a cir
actually the size would be,
size = front > rear ? (MAX - front + rear + 1) : (rear - front + 1);
or one can go for a generic formula:
size = abs(abs(MAX - front) - abs(MAX -rear));//this works in every situation