Radix sort for strings

Published

2023-08-05

We don’t go over this in any video lectures, but in case you’re interested here’s a quick implementation of radix sort for strings. We work from right to left, and make use of the fact that char types have an underlying representation as an int (so, for example the letter ‘a’ has a value of 97). This is by way of a proof of concept, and is restricted to three-character strings of lower-case ASCII letters, but it will give you an idea of how radix sort works for strings. Have a look.

Radix sort for strings

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

All materials copyright © 2020–2023, The University of Vermont. All rights reserved.