Regarding modulus

it will also work even if we don’t apply modulus to ai variable…what is use of modulus here?

Hi,
See the modulus is used to get to the first index after the last one as if this.first is equal to 5 which is more than the size of array which is 4 so in that case modulus of 5 with data.length which is 5 will make this.front as 0 to point to the first index which will make this.front as valid

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.