I have a question about quicksort. From what I've read, the value you pick as your pivot can have an effect on the overall performance of the algorithm. So how do you pick a pivotal value? I guess the easiest method would be, given the size of the array, to choose the middlemost element (e.g. in an array of 25 elements, element 12 is your pivot); but it's probably not the most efficient way.
So how should I decide what element to pick as a pivot?
the value you pick as your pivot can have an effect on the overall performance of the algorithm.
Sometimes. Always picking the median means that the performance depends on the data. This is bad if the source produces consistently worse-than-average data. Picking a random element removes the data as a factor, and the algorithm will always have an average complexity of O(n log n).
In general the pivot point can affect the execution, but a random point is generally fine. There's also that three-way median method, but no matter what pivot you choose, there is a list that can cause worst complexity for that method.