Let's prove that the extreme worst case n * k operations is not possible (just to get the idea, and the rest in-between-ish can be proven similarly):
How to achieve n * k? At each step, we need to make k "pops" from the deque. So the elements in the deque looks like this (in this illustration, k == 5):
before:
| , #
| | | , # (like a heavy bowling ball)
| | | | , #
---------------------------------------------------
^^^^^^^^^ ^
our deque new badass element coming *vruuuum*
after
#
# *bang* (sound of all pins knoked down)
#
---------------------------------------------------
^
this new guy totally smashed our deque in 5 operations!
but hey... wait a minute
How did our deque accumulated k elements?
Well, for it to accumulate k elements, it should throw much less in the previous k steps (otherwise the deque would be empty from the start). Crap... no n * k for ya :(
This makes a more general statement about the dynamics of our algorithm:
If ith element of the array results in m "pops" from the deque, the previous elements would sure be "lame" enough to even out the "badassness" of the ith element.
Now, if you look not from perspective of a deque but from a perspective of a whole array: each time you're throwing a unique array element. So the number of "pops" should not be greater than the number of elements in array, which is n.
Which makes our complexity O(n).