One unit of CS50 AP's curriculum focuses on three main sorting algorithms: bubble sort, selection sort, and insertion sort. There is also discussion of something more efficient like merge sort. One programming assignment has students write the code in C to each of the three simpler sorting algorithms. Students get clear pseudocode of how each works, but they are left to work out the code on their own.In contrast I just started working through Princeton's excellent Algorithms course on Coursera (Algorithms, Part I). The first unit there focused on quick find, quick union, and weighted quick union. The algorithms -- both in pseudocode and in Java -- were given by the instructor; the programming assignment (Percolation) involved the correct use of weighted quick union. Rather than implement it, I just had to apply it with the provided class WeightedQuickUnionUF.Similar to the Princeton course, the AP CS A curriculum teaches sorting algorithms but only use thereof, not direct implementation (e.g. students are not expected on the exam to write insertion sort from memory). Instead, students have to understand it and be able to trace through steps in the sorting process.So there seem to be two approaches here (not limited to just sorting algorithms): teaching the challenge of coding an algorithm from scratch (via implementation) vs. giving students the algorithm to apply to a particular problem (via application). Is there a significant benefit in having students attempt to implement an algorithm from scratch? If so, is this the more effective approach for teaching?
How to teach algorithms: implementation or application?
curriculum design;algorithms