
The algorithm is best explained in its original terms: index cards. Let's imagine you want to memorize the Ethiopic syllabary. Imagine that you have a stack of cards with content that you want to memorize. We'll call this the "deck."

Each card has an Ethiopic syllable on one side, and its sound on the other. Here are three, for example:

If you start with these three cards, it's not too hard to remember... (You probably already have!) Once you've learned those three, you put them into the first bin in the memo box, just as illustrated up at the top.
And then you take another card from the deck (maybe it's "ma"), and you try to remember it, and then put it in the first bin too. You keep doing this until the first bin is filled up:

At this point, you want to add another card. But before you can learn a new card from the deck and put into the first bin (the only place a card from the deck can ever go), you have to make room. To do that, you take the last card in the first bin.
You can move that into the second bin, to make room... but only if you remember it again. So, you take a look at the last card. Maybe it's your old friend "bi". You can remember that, no problem... into the second bin it goes. Now there's more room in the first bin, and you can start working on the deck again.
But a little later, you have to make room, and up comes... drat, what was that one again with the little arm off waving to the side... you've forgotten. Oops, "bu".
So instead of being promoted to the second bin, "bu" goes back into the bottom of the deck. Here's a picture of the last two turns:

And that's really the whole algorithm. The bins increase in size, so you have to really remember a card well as it start climbing higher, because it takes longer and longer before you see it again. And if you forget, it's sent back off to the bottom of the deck and has to start all over again.
By the time you've gotten the whole deck into the last bin, you really have memorized that deck pretty well.
Now, all we have to do is figure out how to program all this...
Post script: I learned the Katakana from a book called Remembering the Katakana (with a supplement on Learning How to Remember). The system worked quite well for me; I still remember some of the mnemonics given in the book, which I used when I was in my late teens... cough half my life ago. The algorithm described above is the same one described in the appendix to that book.