O'Reilly logo

C# Data Structures and Algorithms by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Quicksort

The last sorting algorithm described in this book is named quicksort. It is one of the popular divide and conquer algorithms, which divide a problem into a set of smaller ones. Moreover, such an algorithm provides developers with an efficient way of sorting. Does this mean that its idea and implementation are very complicated? Fortunately, no! You will learn how the algorithm works, as well as what its implementation code can look like in this section. Let's start!

How does the algorithm work? At the beginning, it picks some value (such as from the first or the middle element of the array) as a pivot. Then, it reorders the array in such a way that values lower than or equal to the pivot are placed before it (forming the lower subarray), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required