I'm posting an answer for anyone potentially interested. Apparently the code itself is fine. The csv test file given to us from our uni professors is specifically made to be the worst case scenario for the quicksort (and no thry just didn't tell us) so the code is just not optimized for that scenario. If you have any idea on how to optimize it feel free to tell me. Ty yall.