# Why Counting Sort (and Radix Sort) don't work with Negative Numbers!

**URL:** https://forum.kirupa.com/t/why-counting-sort-and-radix-sort-dont-work-with-negative-numbers/667105
**Category:** web dev
**Created:** [May 25, 2024, 4:08am UTC](https://forum.kirupa.com/t/why-counting-sort-and-radix-sort-dont-work-with-negative-numbers/667105 "2024-05-25T04:08:42Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)
#### Post date: [May 26, 2024, 1:05am UTC](https://forum.kirupa.com/t/why-counting-sort-and-radix-sort-dont-work-with-negative-numbers/667105/5 "2024-05-26T01:05:42Z")

</div>

It was an interesting prompt about array subscripts in any event. I think what got me started thinking was something like, if `array[-1]` and `array[-2]` are both `undefined`, how could code differentiate the two for sorting purposes.

---

_[View the full topic](https://forum.kirupa.com/t/why-counting-sort-and-radix-sort-dont-work-with-negative-numbers/667105)._
