codeintuition-logo

Determining the size of the queue


The size operation tells the caller about the current size of the queue. The operation becomes quite simple since we store the currentSize variable in the queue class, tracking the current queue size. We need to return this value.

Loading Image

Size of the queue is stored in a member variable of the queue class

Algorithm

  • Step 1: Return the value of `currentSize`.

Liking the course? Check our discounted plans to continue learning.