Added pivot type as a parameter

Tested all three requested pivots in order to get the answers.
First case: pivot is first element
Second case: pivot is last element
Third case: pivot is median of three