+ 1
cyclic queue
In this code when I am trying to perform enqueue operation, keeping in mind of the cyclic approach,when I have entered operation 1 second time it is showing "OVERFLOW". INPUT: 1 77 1 https://code.sololearn.com/cbQydU0g562y/?ref=app
1 Answer
+ 1
harshit , why u r doing so many checks in enqueue function??
1. only front and rear == -1 to add first one
2. rear == max -1 and front ==0 to check for oveflow
3. two checks here in last condition.....one is to set rear as rear +1 and if it is last, set rear as 0 to ensure circularity