generating sorted lists
In the technique #2 above, we generate a sorted list. But how do we do that?
This week’s challenge is to come up with ideas how we might do that. Don’t worry if your idea is crazy. The intent is to engage your brain and get thinking about how to generate values.
Here are two I’ll just throw out there to plant a seed:
- Generate random lists and throw out unsorted ones. (Clearly, this won’t work, but that’s okay! I’ll throw it out there anyway.)
- Generate random lists and sort them. (Is this cheating? It doesn’t matter. I’m putting it out there.)