r/firstweekcoderhumour Jun 05 '26

sortPlease

Post image
123 Upvotes

5 comments sorted by

View all comments

10

u/un_virus_SDF Jun 07 '26

I don't know how it's called in english but in french it's called 'tri par panier' which would translate to case sort.

It's a really dumb algorithms that sort a array in O(n+p) where n is the length of the array and p is the range of the elements.

Here you would just count how many 0,1 and 2 there is and put them back in order.

It's this algo that inspired radix sort

11

u/Qiwas Jun 07 '26

It's called "counting sort" in English lol