I have done absolutely everything that i could to try to understand this algorithm. I did NOT want to go on without understanding it completely even though I know it might only be a single problem in the midterm and I think I might have already burned myself out anyways. I even performed the algorithm by hand, which did allow me to understand that when the high_border and low_border indices are equal, to only swap it with the pivot if arr[low_border] is greater than the pivot. This helped when I was trying to sort the following array: {3, 4, 1, 7, 5, 8, 0}. But even then, the computer only sometimes sorts it correctly. The same can be said for any other list. Here is the video that I tried to follow when learning about this algorithm:
https://www.youtube.com/watch?v=Fiot5yuwPAg&t=59s
Please help me, I have been at this for 9 total hours (3 last night, 3 before I went to class and another 3 right after class).
The full code for the program(in java) is here: https://pastebin.com/cRF1xjcs