Slideshow

Sunday, 24 February 2013

273 . Suppose a queue is maintained by a circular array QUEUE with N = 12 memory
cells. Find the number of elements in QUEUE if
(i) Front = 4, Rear =8.
(ii) Front = 10, Rear = 3.
(iii) Front = 5, Rear = 6 and then two elements are deleted




ans:
there are total of 12 elements
1 2 3 4  ..........8 9 10 11 12
         f             r  --->total of there are 5 elements
1 2 3.............10 11 12
      r              f  ----->it is circular fashion given in q ,,,the no of elements is 6(starts with front and ends with rear)
1 2 3 4 5 6 ..........12
            f  r---->after deletion of two elements result is zero.

No comments:

Post a Comment