stack overflow, the problem is never reduced (line 23).
Also, ¿what's the meaning of `pivot'?
At line 13 it seems to be an element, but at line 22 you treat it as an index.
And you never consider the last element of the array, your loop stops too soon.
I am trying to do quick sort