Just finished the insertion sort with J. He got the sort working correctly. After doing this sort with Nick the other day. I was able to see that there needed to be a check to see if the input array had only one item. The nature of the insertion sort algorithm requires the user to check the second element in the array against the first one.
Perhaps the lesson to learn here is that all programmers will code a problem in a hundred different and small ways. Yet another lesson in life that, each person is unique and the solutions offered will never come in exactly how you expect them to.
Lessons pointed out today:
- Be careful of your indentation. The if and else at the bottom of your code looks like it’s a new code block and not part of the while. Keep this in mind!
- I really enjoy the data structure you drew on the right side. I particularly like to see all the data constrained in little boxes.
- Proposed the question, “What would you do if you entered a codebase where the original authors used brackets on the line following the for statement?” J answered: “I would conform my coding style to theirs.” I smiled, “Excellent answer.”
“Look at today as an investment in tomorrow.” – Unknown