3 ms·
Is this actually sorting? It sounds more like a one-to-one mapping function. In Lisp, you would use mapcar or a related map* function to do this. Sending the
by ksaj 5y ago
Is this actually sorting? It sounds more like a one-to-one mapping function.
In Lisp, you would use mapcar or a related map* function to do this.
Sending the kids in to search for their own balloons sounds like a (poor) sorting algorithm. But having pairs right from the get-go sounds like consing.
- byoung2 5y agoSending the kids in to search for their own balloons sounds like a (poor) sorting algorithm Haha true, I think that was the lesson. But sending kids to search for anyone's balloon and then assign it to the correct person seemed to be more efficient.
- ksaj 5y ago> assign it to the correct person ... That's the mapping function in action. It's not really sorting. It's a good story for teaching cooperation. If you wanted to apply it to an algorithm, it would look a lot like multi-agent modeling where you have a dozen kids, a dozen balloons, and each kid doing a single mapping function. In the inefficient model, each kid was doing a search function. In the efficient model, each kid was doing a map function. Also: It reminds me of statistical analysis. An example of that is, if a PIN number fails at 3 attempts in a certain time frame, and you have hundreds of accounts, you are more likely to succeed if you use 1 pin for all accounts, and then increment the pin attempts each round, versus trying all pins on each account and getting locked out on the third attempt before you increment accounts each time. Statistically you'll get more hits faster one way over the other by the time the algorithm completes.
- byoung2 5y agoMakes sense!