Quicksort is a sorting algorithm that works by partitioning an array around a pivot value, and then recursively sorting the sub-partitions. It chooses a pivot element and partitions the array based on whether elements are less than or greater than the pivot. Elements are swapped so that those less than the pivot are moved left and those greater are moved right. The process recursively partitions the sub-arrays until the entire array is sorted.