For example, consider the deterministic sorting algorithm quicksort. This solves the problem of sorting a list of integers that is given as the input. The worst-case is when the pivot is always the largest or smallest value in the list (so the list is never divided). In this case the algorithm takes time O("n"2). If we assume that all possible permutations of the input list are equally likely, the average time taken for sorting is O("n" log "n"). The best case occurs when each pivoting divides the list in half, also needing O("n" log "n") time.