Implementation of max element in window

in the printmax function why do we again print the front of queue at last

since the queue has the greatest element of that window at the front

what we are doing is mantaining the largest element in front and adding any element larger than back of the queue by first removing the back element
also pop front if index goes out of bound

so we print front just because it has the largest element index

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.