![]() ![]() The last important point is how you express your thoughts as code. The easier it is to test your program, the freer you are in experimenting with changes. Make sure you test the complete program as well, errors can creep in in the way the different parts interact. Only after you’re confident that each part works as you expect you can attempt to plug them together. This is why you should try to test each sub task you identified during your task-breakdown by itself. Finding a problem in a small and easy piece of code is much simpler than trying to spot it in a large program. Everybody makes mistakes while programming and finding mistakes in programs consumes a very large part of a programmer’s work-day. To make good progress in your programming task, you need to test your work as early and as thoroughly as possible. Then continue this task breakdown process until you’re confident you know how to write the necessary program. Then you have to teach the computer 1) how to find the smallest element, 2) how to write it down, 3) how to cross it out, and wrap this in a loop. A reasonable method would be to find the smallest element, write it down and cross it out of the original list and repeat this process until you have sorted the whole list. For example if the task is sorting lists, sort some short lists yourself. I encourage you to first solve a few instances of a problem by hand and think about what you did to find the solution. The skill you need to acquire is thinking very precisely about how you solve the problem and breaking it down into steps that are so simple that a computer can execute them. Conceptually it is not very difficult to write a program that solves a problem that you can solve yourself. Learning to program means learning how to solve problems using code. ![]() This guide has been translated to Chinese by yifeitao Simple Programming Problems in Chinese Before you begin ![]() I suppose they are also useful, although much easier, whenever an experienced person wants to learn a new language. The List exercises for example are more complicated in languages like C that don’t have build-in support for lists. The difficulty of the exercises of course somewhat depends on the programming language you use. Except for the GUI questions, exercises are generally algorithmic and should be solvable without learning any libraries. It will be extended as I come up with new exercises. This page is a collection of progressively more difficult exercises that are suitable for people who just started learning. Problems from Project Euler and the like are usually much too difficult for beginners, especially if they don’t have a strong background in mathematics. Whenever I’m TA for a introductory CS class where students learn some programming language, I have trouble coming up with good exercises. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |