Write an efficient sorting algorithm for a list of unsigned 32-bit integers in Leo.

As the first contest, we will start with a modest case for a list of length 10. Your solution must support generic sorting of any list of u32 integers of length 10. For example:

Example Test Cases

Before - [8u32, 2u32, 4u32, 3u32, 5u32, 10u32, 7u32, 1u32, 9u32, 6u32]

After    - [1u32, 2u32, 3u32, 4u32, 5u32, 6u32, 7u32, 8u32, 9u32, 10u32]

Before - [34u32, 52u32, 999999u32, 84u32, 215u32, 102u32, 888u32, 9292u32, 50482u32, 954u32]

After    - [34u32, 52u32, 84u32, 102u32, 215u32, 888u32, 954u32, 9292u32, 50482u32, 999999u32]

The objective is to develop a generic sorting algorithm in Leo for this using the least number of constraints possible.

As a hint, we suggest taking a look at the “Selection Sort” algorithm.

Getting Started

  1. Download Aleo Studio and/or Install Leo.

Option A To get started, install Aleo Studio. Disclaimer: Aleo Studio is currently on Leo v1.0.4.