# Why would you use anything other than Quicksort?

**URL:** https://forum.kirupa.com/t/why-would-you-use-anything-other-than-quicksort/660593
**Category:** Uncategorized
**Created:** [August 1, 2023, 6:08pm UTC](https://forum.kirupa.com/t/why-would-you-use-anything-other-than-quicksort/660593 "2023-08-01T18:08:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Yoshiii](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/yoshiii/32/31156_2.png) [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)
#### Post date: [August 1, 2023, 6:08pm UTC](https://forum.kirupa.com/t/why-would-you-use-anything-other-than-quicksort/660593/1 "2023-08-01T18:08:31Z")

</div>

I read through all the sort algorithms listed here: [Learn Data Structures and Algorithms](https://www.kirupa.com/data_structures_algorithms/index.htm)

It seems like Quicksort is the fastest and what many languages use as their default built-in sorts. If that is the case, why would I use a much slower sort like Insertion or Selection?

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [August 2, 2023, 3:29am UTC](https://forum.kirupa.com/t/why-would-you-use-anything-other-than-quicksort/660593/2 "2023-08-02T03:29:02Z")

</div>

Hi @Yoshiii - there are two reasons:

1. **Valid Reason #1** : You have fixed memory and need to sort without using up any extra memory. Insertion sort, for example, takes up a constant amount of memory to do its sorting.

2. **Sorta Valid Reason #2** : Quicksort is more complicated to implement. For small-ish amounts of data, both insertion sort and selection sort are as fast if not faster than quicksort. If your data is partially sorted already, you can get even faster than the default Quicksort case with smaller amounts of data.

Hope this helps 🙂

Cheers,  
Kirupa

---

<div class="post-metadata">

### Author: ![harrybrook](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@harrybrook](https://forum.kirupa.com/u/harrybrook)
#### Post date: [August 18, 2023, 8:54pm UTC](https://forum.kirupa.com/t/why-would-you-use-anything-other-than-quicksort/660593/3 "2023-08-18T20:54:35Z")

</div>

Quicksort is undoubtedly efficient, but sometimes, the input data distribution can impact its performance. Other sorting algorithms like Merge Sort or Heap Sort might be preferable for datasets with predictable patterns, as they offer consistent time complexity regardless of input.
