Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.0.1 #1071

Merged
merged 43 commits into from Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d88ecfb
delete link to video that doesn't exist
eAlasdair Jun 28, 2019
c494b33
fix spelling, formatting and remove broken links
eAlasdair Jun 28, 2019
c7ad761
fix miles in a kilometer
eAlasdair Jun 28, 2019
68035f4
Merge branch 'release/3.0.0' into develop
JackMorganNZ Jun 30, 2019
da867bf
minor changelog fixes
eAlasdair Jun 30, 2019
7b3a9fc
Merge branch 'develop' into issue/1044
eAlasdair Jun 30, 2019
bfc4ad0
Merge pull request #1045 from uccser/issue/1044
eAlasdair Jun 30, 2019
fbf9dad
Merge branch 'develop' into issue/1037
eAlasdair Jun 30, 2019
1eab83a
only hide backface on firefox
eAlasdair Jun 30, 2019
b82e678
Merge pull request #1055 from uccser/issue/1037
eAlasdair Jun 30, 2019
1ac0e8b
Merge branch 'develop' into issue/1056
eAlasdair Jun 30, 2019
d2d0f12
Redirect for homepage.
courtneycb Jul 1, 2019
325e015
Merge pull request #1057 from uccser/issue/1056
eAlasdair Jul 1, 2019
1c2daed
many more content fixes
eAlasdair Jul 1, 2019
c27c133
Merge branch 'develop' into content/fixes
eAlasdair Jul 1, 2019
c707610
fix floating elements overlapping subsection divider
eAlasdair Jul 1, 2019
d174756
Add background to navigation dropdown.
courtneycb Jul 1, 2019
954c8a8
Fix.
courtneycb Jul 1, 2019
cb07b14
Merge branch 'develop' into issue/1054
courtneycb Jul 1, 2019
001f36b
tidy up scss.
courtneycb Jul 1, 2019
dcdbae4
Change class name.
courtneycb Jul 1, 2019
2e293ff
Merge pull request #1060 from uccser/content/fixes
eAlasdair Jul 1, 2019
77a5605
Merge branch 'develop' into issue/1059
eAlasdair Jul 1, 2019
3f04298
Merge branch 'develop' into issue/1054
eAlasdair Jul 1, 2019
4002bb3
Merge pull request #1062 from uccser/issue/1059
eAlasdair Jul 1, 2019
91972a6
Merge branch 'develop' into issue/1054
courtneycb Jul 1, 2019
79281e3
Add CGs to useful links
eAlasdair Jul 1, 2019
d0c672f
Merge pull request #1064 from uccser/issue/1054
courtneycb Jul 1, 2019
d1f0dc9
Merge branch 'develop' into issue/1052
eAlasdair Jul 1, 2019
3023f1b
Merge pull request #1067 from uccser/issue/1052
eAlasdair Jul 1, 2019
457d136
Merge branch 'develop' into url-redirect-fixes
courtneycb Jul 2, 2019
c6f17e9
Remove incorrect redirects.
courtneycb Jul 2, 2019
54a82c3
Merge pull request #1058 from uccser/url-redirect-fixes
courtneycb Jul 2, 2019
72a65dd
add reshuffle weights button
eAlasdair Jul 2, 2019
f50b0c6
Merge pull request #1070 from uccser/interactives/sorting-algorithms
eAlasdair Jul 2, 2019
5498d08
Update version number.
courtneycb Jul 2, 2019
68ad4f8
Update changelog.
courtneycb Jul 2, 2019
802a171
Fix broken link.
courtneycb Jul 2, 2019
ea1ca02
Fix links.
courtneycb Jul 2, 2019
7b40abc
Use bootstrap variable.
courtneycb Jul 3, 2019
a378fb0
Remove word 'adage'
courtneycb Jul 3, 2019
14970dd
Remove italics around glossary terms.
courtneycb Jul 3, 2019
5d2a870
Lowercase unicode.
courtneycb Jul 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -15,7 +15,7 @@ After students have finished the first part ask them questions like "Did anyone
While they are playing the second part some may have trouble finding the correct algorithm to find the target number.
If they are finding these levels confusing you can give them a hint like "Why don't you start by opening the box in the centre" and when they do ask them "What does the number you found tell you about all the numbers before it?" if the number is smaller than the one they are looking for, or "all the numbers after it?" if the number is bigger than the one they are looking for.

When students have finished ask them questions like "Were you able to find the target number even though you had less lives? What strategy did you use to find the target number?", we have found that many students will have ended up doing a binary search (or similar) without even knowing what a binary search is!
When students have finished ask them questions like "Were you able to find the target number even though you had fewer lives? What strategy did you use to find the target number?", we have found that many students will have ended up doing a binary search (or similar) without even knowing what a binary search is!
Explaining these algorithms to students is likely to be easier now that they have seen them in action.

{panel end}
Expand All @@ -38,7 +38,7 @@ This might not seem like such a bad thing since you had enough lives to look und
It would have taken far too long to look through all the boxes and the target number might have never been found.

Now this next game is slightly different.
You have less lives, which makes things a bit more challenging, but this time the numbers inside the boxes will be in order.
You have fewer lives, which makes things a bit more challenging, but this time the numbers inside the boxes will be in order.
The box with the smallest number is on the far left, and the one with the largest number is on the far right.
Let's see if you can find all the target numbers without running out of lives...

Expand Down Expand Up @@ -69,7 +69,7 @@ For a list of 10 items this means on average you would only have to look at 5 it

# How is bozo search different from linear search?

If you watched the video at the beginning of the chapter you might be thinking that what you did in the box searching game sounds more like bozo search than linear search, but actually bozo search is even sillier than this!
If you watched the video at the beginning of the chapter you might be thinking that what you did in the box searching game sounds more like {glossary-link term="bozo-search"}bozo search{glossary-link end} than {glossary-link term="linear-search"}linear search{glossary-link end}, but actually bozo search is even sillier than this!
If you were doing a bozo search then after opening a box and finding the wrong number, you would close the box back up and try another one at random!
This means you might end up checking the same box again and again and again and you might never find the target number, even with a small number of boxes!

Expand Down
Expand Up @@ -24,15 +24,19 @@ It characterises the resources needed by an algorithm and is usually applied to

Here are some Big O examples:

- $$ O(1) $$ - An algorithm with $$ O(1) $$ complexity will always execute in the same amount of time regardless of how much data you give it to process. For example, finding the smallest value in a sorted list is always easy.
- $$ O(n) $$ - The amount of time an algorithm with $$ O(n) $$ complexity will take to execute will increase roughly linearly with (i.e. in direct proportion to) the amount of data you give it to process. The high-score algorithm was $$ O(n) $$, and so was the linear search.
- $$ O(n^{2}) $$ - The performance of an algorithm with this complexity is roughly proportional to the square of the size of the input data set. Selection sort and insertion sort take $$ O(n^{2}) $$ time. That's not very good value - 10 times the amount of input will take 100 times as long!
- $$ O(2^{n}) $$ - The amount of time an algorithm with this complexity will take to complete will double with each additional element added to the data set! We haven't seen these kinds of situations in this chapter, but they are common, and are a theme of the Complexity and Tractability chapter. Algorithms that are this slow can be almost impossible to use!
- \( O(1) \)
- An algorithm with \( O(1) \) complexity will always execute in the same amount of time regardless of how much data you give it to process. For example, finding the smallest value in a sorted list is always easy.
- \( O(n) \)
- The amount of time an algorithm with \( O(n) \) complexity will take to execute will increase roughly linearly with (i.e. in direct proportion to) the amount of data you give it to process. The high-score algorithm was \( O(n) \), and so was the linear search.
- \( O(n^2) \)
- The performance of an algorithm with this complexity is roughly proportional to the square of the size of the input data set. Selection sort and insertion sort take \( O(n^2) \) time. That's not very good value – 10 times the amount of input will take 100 times as long!
- \( O(2^n) \)
- The amount of time an algorithm with this complexity will take to complete will double with each additional element added to the data set! We haven't seen these kinds of situations in this chapter, but they are common, and are a theme of the [Complexity and Tractability chapter]('chapters:chapter' 'complexity-and-tractability'). Algorithms that are this slow can be almost impossible to use!

{panel end}

Big O Notation however requires some advanced mathematics to explore thoroughly so has been intentionally left out of this main chapter, but if you want to learn more check out the Useful links section.
These topics are looked at in more depth in the Complexity and Tractability chapter.
Big O notation however requires some advanced mathematics to explore thoroughly so has been intentionally left out of this main chapter, but if you want to learn more check out the [Further reading]('chapters:chapter_section' 'algorithms' 'further-reading') section.
These topics are looked at in more depth in the [Complexity and Tractability chapter]('chapters:chapter' 'complexity-and-tractability').

To make things even more complicated, theoretical analysis techniques such as Big O Notation are extremely useful when designing and predicting performance but empirical analysis such as stopwatch timing shows that in practice algorithm performance can vary greatly due to hardware and operating system design.
Most computers have cached memory and virtual memory, where the time to access a particular value can be particularly short, or particularly long.
Expand Down
Expand Up @@ -27,19 +27,19 @@ go through each score keeping track of the largest so far.
Informal instructions like this aren't precise; there's no way that a computer could follow those instructions exactly, but a human could probably get the general idea of what you mean if they know what you're trying to achieve.
This sort of description is only useful for quickly giving another human the general idea of what you mean, and even then there's a risk that they won't properly understand it.

In contrast, an {glossary-link term="algorithm" reference-text="introduction"}algorithm{glossary-link end} is a step by step process that describes how to solve a problem and/or complete a task, which will always give the correct result.
In contrast, an algorithm is a step by step process that describes how to solve a problem and/or complete a task, which will always give the correct result.
For our previous non-computing example, the algorithm might be

1) Go to the kitchen.
2) Pick up a glass.
3) Turn on the tap.
4) Put the glass under the running water and remove it once it is almost full.
5) Turn off the tap.
6) Take the glass back to the person who gave the instruction.
1. Go to the kitchen.
2. Pick up a glass.
3. Turn on the tap.
4. Put the glass under the running water and remove it once it is almost full.
5. Turn off the tap.
6. Take the glass back to the person who gave the instruction.

A human could follow these instructions easily, but it's still using general English language rather than a strict list of computer instructions.

Algorithms are often expressed using a loosely defined format called [pseudo-code](https://en.wikipedia.org/wiki/Pseudocode), which matches a programming language fairly closely, but leaves out details that could easily be added later by a programmer.
Algorithms are often expressed using a loosely defined format called [pseudo-code](https://en.wikipedia.org/wiki/Pseudocode), which matches a {glossary-link term="programming-language"}programming language{glossary-link end} fairly closely, but leaves out details that could easily be added later by a programmer.
Pseudocode doesn't have strict rules about the sorts of commands you can use, but it's halfway between an informal instruction and a specific computer program.

With the high score problem, the algorithm might be written in pseudo-code like this:
Expand All @@ -59,7 +59,7 @@ The other important thing with this level of precision is that we can often make
For the high score problem above, if the score table gets twice as big, the algorithm will take about twice as long.
If the table could be very big (perhaps we're tracking millions of games and serving up the high score many times each second), that might already be enough to tell us that we need a better algorithm to track high scores regardless of which language it's going to be programmed in; or if the table only ever has 10 scores in it, then we know that the program is only going to do a few dozen operations, and is bound to be really fast even on a slow computer.

The most precise way of giving a set of instructions is in the form of a {glossary-link term="algorithm" reference-text="computer program"}program{glossary-link end}, which is a specific implementation of an algorithm, written in a specific programming language, with a very specific result for any particular input.
The most precise way of giving a set of instructions is in the form of a program, which is a specific implementation of an algorithm, written in a specific programming language, with a very specific result for any particular input.
This is the most precise of these three descriptions and computers are able to follow and understand these.

For the example with getting a drink, we might program a robot to do that; it would be written in some programming language that the robot's computer can run, and would tell the robot exactly how to retrieve a glass of water and bring it back to the person who asked for the water.
Expand Down Expand Up @@ -104,10 +104,10 @@ That's worth knowing in advance because we usually need our programs to scale up

# Algorithm complexity

The formal term for working out the cost of an algorithm is [algorithm analysis](https://en.wikipedia.org/wiki/Analysis_of_algorithms), and we often refer to the cost as the algorithm's *complexity*.
The formal term for working out the cost of an algorithm is [algorithm analysis](https://en.wikipedia.org/wiki/Analysis_of_algorithms), and we often refer to the cost as the algorithm's *{glossary-link term="complexity"}complexity{glossary-link end}*.
The most common complexity is the "time complexity" (a rough idea of how long it takes to run), but often the "space complexity" is of interest - how much memory or disk space will the algorithm use up when it's running?

There's more about how the cost of an algorithm is described in industry, using a widely agreed on convention called 'Big-O Notation', in the ["The whole story!"]('chapters:chapter_section' 'algorithms' 'the-whole-story') section at the end of this chapter.
There's more about how the cost of an algorithm is described in industry, using a widely agreed on convention called {glossary-link term="big-o"}'Big O Notation'{glossary-link end}, in the ["The whole story!"]('chapters:chapter_section' 'algorithms' 'the-whole-story') section at the end of this chapter.

{panel end}

Expand All @@ -122,7 +122,7 @@ Some algorithms will always make the same number of comparisons for a certain in
If we develop or are given an algorithm to solve a problem, how do we know that it works?
Sometimes we create test cases to verify the algorithm produces correct output for specific input values.
While this is a useful practice and can help verify that we are on the right track, it is not enough to show that our algorithm is correct.
The old adage "even a broken watch is correct twice a day" is a good analogy.
The old {glossary-link term="adage"}adage{glossary-link end} "even a broken watch is correct twice a day" is a good analogy.
courtneycb marked this conversation as resolved.
Show resolved Hide resolved
Even an algorithm that is correct for two test cases might be incorrect for every other input.
A computer scientist must reason formally or mathematically about an algorithm to show its correctness.
Typically this is done by classifying ranges of input values and showing that algorithm produces expected results for boundary values of the range and all values in between.
Expand All @@ -144,7 +144,8 @@ Often there are good reasons to know multiple correct algorithms because there a

## Searching and sorting

In this chapter we will look at two of the most common and important types of algorithms, searching and sorting. You probably come across these kinds of algorithms every time you use a computer without even realising!
In this chapter we will look at two of the most common and important types of algorithms, searching and sorting.
You probably come across these kinds of algorithms every time you use a computer without even realising!
They also happen to be great for illustrating some of the key concepts that arise with algorithms.

{glossary-link term="algorithm" reference-text="searching algorithms"}{glossary-link end}
Expand Up @@ -2,10 +2,10 @@

The substitution systems described above don't provide any security for modern digital systems.
In the remainder of this chapter we will look at encryption systems that are used in practice.
The first challenge is to find a way to exchange keys after all, if you're communicating to someone over the internet, how are you going to send the key for your secret message to them conveniently?
The first challenge is to find a way to exchange keys – after all, if you're communicating to someone over the internet, how are you going to send the key for your secret message to them conveniently?

Cryptosystems are also used for purposes such as *authentication* (checking a password).
This sounds simple, but how do you check when someone logs in, *without* having to store their password (after all, if someone got hold of the password list, that could ruin your reputation and business, so it's even safer not to store them).

There are good solutions to these problems that are regularly used in fact, you probably use them online already, possibly without even knowing!
There are good solutions to these problems that are regularly used – in fact, you probably use them online already, possibly without even knowing!
We'll begin by looking at systems that allow people to decode secret messages without even having to be sent the key!
Expand Up @@ -149,7 +149,7 @@ If on the other hand you were asked which two prime numbers were multiplied to g
Creating an RSA code involves doing the multiplication above, which is easy for computers.
If we could solve the second problem and find the multiples for a big number, we'd be able to crack an RSA code.
However, no one knows a fast way to do that.
This is called a "trapdoor" function - it's easy to go into the trapdoor (multiply two numbers), but it's pretty much impossible to get back out (find the two factors).
This is called a "trapdoor" function – it's easy to go into the trapdoor (multiply two numbers), but it's pretty much impossible to get back out (find the two factors).

So why is it that despite these two problems being similar, one of them is "easy" and the other one is "hard"? Well, it comes down to the algorithms we have to solve each of the problems.

Expand Down Expand Up @@ -190,7 +190,7 @@ In order to decrypt it, the corresponding private key must be used.
But what would happen if the message was encrypted using the *private* key?
Could you then decrypt it with the public key?

Initially this might sound like a pointless thing to do why would you encrypt a message that can be decrypted using a key that everybody in the world can access!?!
Initially this might sound like a pointless thing to do – why would you encrypt a message that can be decrypted using a key that everybody in the world can access!?!
It turns out that indeed, encrypting a message with the private key and then decrypting it with the public key works, and it has a very useful application.

The only person who is able to *encrypt* the message using the *private* key is the person who owns the private key.
Expand Down
Expand Up @@ -132,6 +132,8 @@ For the formula for a line this results in:

\\[
m = \frac{(9 - 4)}{(16 - 3)} = 5/13 = 0.384615
\\]
\\[
b = \frac{(4 \times 16 - 9 \times 3)}{(16-3)} = 37/13 = 2.846154
\\]

Expand Down
Expand Up @@ -123,7 +123,7 @@ The

Other explanations aimed at school students include:
- [Math is Fun - Matrix multiplying](http://www.mathsisfun.com/algebra/matrix-multiplying.html)
- [Math in Sight - Matrix vector multiplication](http://mathinsight.org/matrix_vector_multiplication)
- [Math in Sight - Matrix vector multiplication](https://mathinsight.org/matrix_vector_multiplication)
- [Math Planet - Transformation using matrices](http://www.mathplanet.com/education/geometry/transformations/transformation-using-matrices)
- [Wikipedia entry on matrix transformation](https://en.wikipedia.org/wiki/Transformation_matrix) – which likely has too much extra detail for students in it

Expand Down
Expand Up @@ -32,7 +32,7 @@ Can you make black, white, shades of grey, yellow, orange, and purple?

Having all the sliders at the extremes will produce black and white, and if they are all the same value but in between, it will be grey (i.e. between black and white).

Yellow is not what you might expect - it's made from red and green, with no blue.
Yellow is not what you might expect – it's made from red and green, with no blue.

{panel end}

Expand Down Expand Up @@ -92,7 +92,7 @@ We'll cover the answer later in this section if you are still not sure!
The following interactive allows you to zoom in on an image to see the pixels that are used to represent it.
Each pixel is a solid colour square, and the computer needs to store the colour for each pixel.
If you zoom in far enough, the interactive will show you the red-green-blue values for each pixel.
You can pick a pixel and put the values on the slider above - it should come out as the same colour as the pixel.
You can pick a pixel and put the values on the slider above – it should come out as the same colour as the pixel.

{interactive slug="pixel-viewer" type="whole-page" text="Pixel Viewer interactive"}

Expand Down Expand Up @@ -335,4 +335,4 @@ However, compression methods require a lot more processing, and images need to b

The ideas in this present chapter more commonly come up when designing systems (such as graphics interfaces) and working with high-quality images (such as RAW photographs), and typically the goal is to choose the best representation possible without wasting too much space.

Have a look at the Compression Chapter to find out more!
Have a look at the [compression chapter]('chapters:chapter' 'coding-compression') to find out more!