“Cycle 46” is ending today at Learners Guild. Each cycle lasts a week. For me, this is week 5. Cycle 46 is a 4-day week, because of Memorial Day, so there has been a bit of pessimism in the air about whether the Learners would have enough time to complete their various projects. But not much. The Guild reminds us not to over-focus on our completion statistics.
Week 5 was my first encounter here with rejection. The Algorithm gave me my first-choice Goal to work on, together with another Learner, but he had not voted for it or, in fact, for any 2-person Goal. He wanted—desperately—to work on a 1-person Goal and asked me to give up my assignment so he could get a Goal that he wanted. It was, he said, part of a self-designed curriculum. I didn’t have the authority to change my assignment, but the staff does. I agreed to go along with his plan. The staff probed him for justification, but gently, and he didn’t yield, so the staff reassigned us—me to a 1-person Goal that was on my agenda. An agreeable outcome from my perspective: I’ve been spared during this 4-day week from negotiating roles with a teammate, and particularly with a reluctant and perhaps resentful one.
Is it beneficial for the Algorithm to impose its unknown rules, including some inevitable unpredictability, as it accepts or rejects the Goals that Learners voted for? Welcome to the real world. I have to assume that I, too, shall find myself some weeks working on Goals I haven’t voted for. So be it. We’re learning to do work that the world wants done (and is willing to pay for). The Algorithm is my boss, and bosses can be tempermental. We need practice in accommodating that.
I managed to complete the specifications on Thursday morning, so I had time to extend the project. Among the topics I explored further were execution efficiency and internationalization.
- If you think about it, you can see that this method requires the computer to do twice as much work as necessary. A comparison of “pinonip” with its inversion, i.e. “pinonip”, compares “o” with “o” once, but compares “p” with “p”, “i” with “i”, and “n” with “n” twice each. But checking the first 3 characters is enough: if “pin” is the same as “pin”, then the full string must be a palindrome. Any non-palindrome, such as “pinonap” (inversion “panonip”) will be detected within the first 3 comparisons.
- Once you decide to compare only the first half with the second half’s inversion, how do you do that? Inverting the second half and then checking whether the two half-strings are identical is one method. But it turns out to be inefficient. It requires creating a new string. Another option is to compare the existing half-strings character by character, counting forward in one and backward in the other, using a “loop”. That runs faster. On my computer, it runs about twice as fast. To answer this question empirically, I needed to run my program on a string about 10 million characters long; much shorter strings were processed so fast that it was hard to measure the difference.
The help I received from more expert personnel here included answers to my specific questions when I failed to find them on my own, but also suggestions that went beyond answers. A suggestion like “I think your solution is not as efficient as one that loops through the existing strings” was enough to send me on my way investigating the issue. Formal instruction this isn’t. My hunch is that it is more effective. For one thing, I never doze off during it.