|
36 | 36 | "* The method of a carbonara recipe is an algorithm designed to assemble certain elements into a meal. \n",
|
37 | 37 | "* Directions are an algorithm designed to navigate a person from A to B.\n",
|
38 | 38 | "* How to read a clock.\n",
|
39 |
| - "* Wet laboratory protocol or or clinical trial protocol or data collection protocol\n", |
| 39 | + "* Wet laboratory protocol or clinical trial protocol or data collection protocol\n", |
40 | 40 | "\n",
|
41 | 41 | "Algorithms are essential tools but they are also really powerful. Apart for the purpose of programming they can be advantageous for the following reasons\n",
|
42 | 42 | "\n",
|
43 | 43 | "1. Reproducibility - having a standardized process means you can ensure the same steps on every execution.\n",
|
44 | 44 | "2. Efficiency - knowing the stages of an algorithm means you can remove redundancy/identify repetitive processes.\n",
|
45 | 45 | "3. Scalability - a clearly defined process can easily be extended to run on larger datasets or more complex problems.\n",
|
46 | 46 | "4. Sharable - efficient way to share a process across colleagues, teams, departments or institutions.\n",
|
47 |
| - "5. Automation - once a solution has be defined you can identify how it can be automated. \n", |
| 47 | + "5. Automation - once a solution has been defined you can identify how it can be automated. \n", |
48 | 48 | "\n",
|
49 | 49 | "\n",
|
50 | 50 | "\n",
|
51 | 51 | "## Faulty design vs faulty implementation \n",
|
52 | 52 | "\n",
|
53 | 53 | "Being an efficient programmer is not only about writing code - it is about solving problems in a way that is translatable to a computer. It means using your knowledge of how a computer or language works, to use relevant constructs as the basis of your solution. Often what people think of as a problem with code writing is in fact a problem with the algorithm. \n",
|
54 | 54 | "\n",
|
55 |
| - "In many of the examples above (recipes and directions) we have probably experienced time when they go wrong. We can use these to demonstrate the distinction between errors in the algorithm compared to errors in how it is transcribed into instructions.\n", |
| 55 | + "In many of the examples above (recipes and directions) we have probably experienced times when they went wrong. We can use these to demonstrate the distinction between errors in the algorithm compared to errors in how it is transcribed into instructions.\n", |
56 | 56 | "\n",
|
57 | 57 | "Let's start with the case of directions, let's say you've arrive in London at Paddington train station and you need to get to Edgware. A friend has helpfully written down the route by the Underground. Your algorithm is as follows:\n",
|
58 | 58 | "\n",
|
|
72 | 72 | "\n",
|
73 | 73 | "Again you get out at your final destination, where the sign says High Barnet. The wrong location again! You call your friend, she runs through the instructions with you again and you compare to your written notes. This time you incorrectly wrote the instructions down. In this instance the problem was a coding error, the algorithm was fine, but you had an error in the set of instructions you used to navigate. \n",
|
74 | 74 | "\n",
|
75 |
| - "Typically coding errors are easier to detect and fix, than problems with the underlying algorithm. A good text editor with syntax and language highlight can prevent these. To pick up issues with the algorithm, requires more manual work, typically working through the algorithm and compare what the code is actually doing compared to what you thought it should be doing. This uses a combination of predicting and evaluation to debug your code.\n", |
| 75 | + "Typically coding errors are easier to detect and fix than problems with the underlying algorithm. A good text editor with syntax and language highlight can prevent these. To pick up issues with the algorithm requires more manual work, typically working through the algorithm and compare what the code is actually doing compared to what you thought it should be doing. This uses a combination of predicting and evaluation to debug your code.\n", |
76 | 76 | "\n",
|
77 | 77 | "Consider the exercise below:\n",
|
78 | 78 | "\n",
|
|
110 | 110 | "print(x+y)\n",
|
111 | 111 | "```\n",
|
112 | 112 | "\n",
|
113 |
| - "Often what we think are issues with implementation are actually issues of algorithm. The claim there is something wrong with my code/script infers that the problem is syntax, when more likely the problem is with what you are asking the computer to do. This phrasing can be misleading as it fails to recognize the distinguish of the two possible sources of error.\n", |
| 113 | + "Often what we think are issues with implementation are actually issues of algorithm. The claim there is something wrong with my code/script infers that the problem is syntax, when more likely the problem is with what you are asking the computer to do. This phrasing can be misleading as it fails to distinguish between the two possible sources of error.\n", |
114 | 114 | "\n",
|
115 | 115 | "## Designing algorithms\n",
|
116 | 116 | "\n",
|
|
138 | 138 | "\n",
|
139 | 139 | "### Activity: Snakes, ladders & flowcharts\n",
|
140 | 140 | "\n",
|
141 |
| - "Snakes and ladders is dice game where players advance along the board based on the roll of the dice. Upon landing on a square on the board, a player may either encounter a snake, where they are forced backwards a number of squares, a ladder, where they advance a number of squares, or nothing, in which case they remain on that square. A player wins when they reach the end of the board.\n", |
| 141 | + "Snakes and ladders is a dice game where players advance along the board based on the roll of the dice. Upon landing on a square on the board, a player may either encounter a snake, where they are forced backwards a number of squares, a ladder, where they advance a number of squares, or nothing, in which case they remain on that square. A player wins when they reach the end of the board.\n", |
142 | 142 | "\n",
|
143 | 143 | "Design a flowchart for the game. The total number of board squares should be 100, and the maximum number of squares a player is advanced or returned should be 30.\n",
|
144 | 144 | "\n",
|
|
0 commit comments