Tag Info

36

As someone who has now taught CS for many years, let me first reassure you that teaching clear, clean coding is entirely worthwhile. I think this is especially true for those who will not go off into software professionally, because editing, and being able to express ideas in a clean, clear manner is a skill that serves people well in any field. (I've ...

6

I emphasize readability and maintenance of code. Therefore, I will assign a project and later turn around and require another student to complete the second half of it. Everyone ends up maintaining someone else's code as a result. I think you should continue teaching your good habits and thinking styles. That said, you see a student doing Olympiad problems ...

5

I have used a similar idea - writing an SHA-1 hash cracker - as a mini-project for students learning Java. These students had previously learned to program in other languages, so they had experience with variables, if/else, loops and functions; the main goal was to get them used to Java's syntax, but some of the specific things they had to do were: Import ...

4

There are a number of sites with challenges- once you complete a challenge you can often view other solutions, and many of these sites (not all) support multiple languages. CodingBat HackerRank Rosalind The Python Challenge TopCoder Project Euler Coding Chef Even the "Python Challenge" tasks can be solved with another language since all you are looking ...

4

Based on clarification in comments, Algorithms 4th ed. by Sedgewick and Wayne seems to meet your criteria. The book itself doesn't seem to have an official PDF version (I haven't searched for unofficial ones of dubious provenance), but the code is available both at the linked page and on Github, and includes solutions to selected exercises.

3

A famous example is Strassen's matrix multiplication algorithm, whose running time satisfies the recurrence $T(n) = 7T(n/2) + O(n^2)$. A similar example is Karatsuba's algorithm for fast integer multiplication, whose running time satisfies the recurrence $T(n) = 3T(n/2) + O(n)$. Other algorithms for multiplying matrices or integers supply even more examples ...

3

I'll give you a straight, simple, and practical answer. Teach clean coding and simple effective thinking. Because in the practical world, the codes are big and have a lot of integration. The reality is that a single coder does not code all of it. As a teacher, you should teach something that is practically feasible. Teach a student to write such a code that ...

3

Back off on clean coding until they can appreciate it. Take named constants (const int maxScore=14) as an example. Showing const along with regular variables will only confuse students -- why is there a special word to make a variable useless? Later using it to "fix" if(s1>14) will probably still confuse them -- it's more typing and more ...

3

Learning is like searching for a treasure hidden in the forest. The teacher can teach to use tools that make the task easier, also provides some tips in order to deal with implementation problems realted to the tool's maturity. The teacher should avoid re-invent the wheel, althougth must speak about the history of how it was invented.

3

Teaching introduces a strong two-way dependency. As a student, one needs a certain amount of trust in the teacher - otherwise, if they already know better, then why on Earth would they need the teacher in the first place. So, if the student is there of their own volition, this already established a need: they need help. The student needs to understand that ...

3

Programming vs language This is the difference between learning to program, and learning a language. It will have analogies in human languages (English, French, etc.) One can know a language, but is one understood; is one poetic; is one concise, is one un-ambiguous. Does it scale Un-clean code does not scale. It is like goto and global valuables, they are ...

3

This answer is a complement to Buffy's and is more oriented towards future applications of autograding. The description of the assignment gave me the impression that your autograder is rather lazy. Instead of checking whether the functions the students have written are correct it executes a bunch of operations and compare a checksum of the result. ...

2

Late answer: I agree greatly with @igordsm's response above (emphasize unit testing with more detailed feedback, not just a "pass/fail" output), so this should be considered in support of that. I agree with the comment by @pojo-guy that the specification seems "unnecessarily convoluted and artificial". Having read the specifications for the 1st and 4th ...

2

A loaf of bread, a knife, a jar of peanut butter and a jar of jelly. Write an algorithm to build a PB&J. Have one of the kids follow the literal direction written by a different kid. This project have been a favorite starter for algorithms for 30 years.

2

Explain and demonstrate the purpose of functions, in context. Putting everything in main() might work for toy programs, but in real programming you want to use functions for a specific reason: you want your code to be able to repeatedly do perform a particular task, producing a particular kind of output when given a particular kind of input. Depending on the ...

2

I'll probably try with this one, from an actual software I almost developed. There's a factory that produces paints in various colours. The factory has a single production line that can produce only one colour in a given moment. It's capacity is also limited, i.e. 1000 litres per day regardless of the colour produced. Different colours have different ...

2

The Sedgwick resource is excellent. Besides online chapter summaries and code examples, it has a corresponding Coursera class with videos and grades exercises.

2

I'm not aware of any singular, central repository for assignment ideas. My sources for project ideas when my own well begin to run dry are: Textbooks. Often, a problem in a problem set will trigger an idea for a full-blown lab assignment. Other similar courses posted by other professors. Obviously, it is important not to simply steal someone's idea. I ...

1

There will come a day when a problem is too hard or too large for him to solve on his own (of course). He is being academically lazy and it will handicap him. Thats a common pitfall for bright kids. It's totally OK to experiment and 'go your own way' when learning for the first time. Learning should be fun. It will help him relate to new information he ...

1

What do you mean your students are not going to become professional coders? Is your education only meant to become a hobby for them? You mentioning coding competitions seems to indicate that this is the case. I think what you really meant is that these people will not be full-time programmers but that they will program as part of their jobs. People in this ...

1

I'll probably get some hate for this, but I personally hate coding in classes and Java in general, it's just not my cup of tea. But I can appreciate good, clean code. I program mostly in php and this makes the use of proper classes less important, as you can just physically separate it into separate pages. But I understand when classes are necessary/use-full....

1

-Tim Roughgarden gives an example of selecting TV advertisements for a fixed time interval, different price for different kinds of goods advertised, and of course different duration for each ad. (called Knapsack auctions) https://youtu.be/BMoSLmuJsak -I think there r examples on utilizing networks fixed B.W., not very sure of the details. -Then, in these ...

1

Sometimes a publisher will provide an answer key, but only to people it is pretty sure are educators. You might write to either an author or the publisher to see what is available. But that book was published by the author, so contact him for information. I suspect there is a web site.

1

Your question doesn't make much sense. First, there are literally thousands of major algorithms, and many of them are quite involved. You don't begin your studies with Red-Black Trees because even their purpose will elude you until you've (at the very least) spent some time dealing with sorts and searches. Second, if you eliminate time complexity and the ...

1

I think this is hard to do in four days. You can barely touch the surface. I think that the most you can likely do is give them an appreciation for why the study of algorithms is useful and important. There is one general sort of algorithm that is "easy" to carry out before students learn to program: Linear Recursion. There are many such problems. The ...

Only top voted, non community-wiki answers of a minimum length are eligible