Question: Write a function intgetCount(QUEUE q) to count the number of elements in a circular queue without using any looping statements. Initial value of front (F)

Write a function intgetCount(QUEUE q) to count the number of elements in a circular queue without using any looping statements. Initial value of front (F) and rear (R) is zero. Each time after inserting an element into the queue the rear pointer points to the last element inserted. Front pointer always points to a location previous to the element to be deleted as shown in the figure below. Assume that neither Insert function nor the queue maintains the count information.

Trace the algorithm for the following cases

Write a function intgetCount(QUEUE q) to count the number of elements in

a. F-0 R-4 b. R=1 F=2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!