Updated the pivot to have a linear time complexity