Students will be introduced to an algorithm that uses a simple pseudocode to quickly count the number of people in a room. Students will create a simple pseudocode.
This activity was created as a result of the DLCS COS Resource Development Summit.
This activity introduces the idea of “divide and conquer” using a fictitious but serious problem – a pair of dirty socks have accidentally been wrapped in one of the presents that Santa is about to deliver, and he needs to figure out which one to avoid a child getting a nasty surprise.
You can either play the video (linked in the activity) or download the PDF of the book (see the PDF files in the link to the activity) to read aloud or give to students.
The solution in the story points out that when there are 1024 boxes to test, instead of having to open all of them until the socks are found, one half can be eliminated at a time, and repeatedly halving the problem very quickly narrows it down to one box (the size of the problem starts at 1024, then with one weighing there are 512 boxes, then 256, 128, 64, 32, 16, 8, 4, 2 and 1.) This idea comes up frequently in the design of fast computer algorithms.
Computer programs often need to process a sequence of symbols such as letters or words in a document, or even the text of another computer program. Computer scientists often use a finite-state automaton to do this. A finite-state automaton (FSA) follows a set of instructions to see if the computer will recognize the word or string of symbols. We will be working with something equivalent to a FSA—treasure maps!
The goal of the students is to find Treasure Island. Friendly pirate ships sail along a fixed set of routes between the islands in this part of the world, offering rides to travelers. Each island has two departing ships, A and B, which you can choose to travel on. You need to find the best route to Treasure Island. At each island you arrive at you may ask for either ship A or B (not both). The person at the island will tell you where your ship will take you to next, but the pirates don’t have a map of all the islands available. Use your map to keep track of where you are going and which ship you have traveled on.
Computers are often used to put lists into some sort of order, for example, names into alphabetical order, appointments or e-mail by date, or items in numerical order. Sorting lists helps us find things quickly, and also makes extreme values easy to see. If you sort the marks for a class test into numeric order, the lowest and highest marks become obvious.
If you use the wrong method, it can take a long time to sort a large list into order, even on a fast computer. Fortunately, several fast methods are known for sorting. In this activity, children will discover different methods for sorting and see how a clever method can perform the task much more quickly than a simple one.
To make computers go faster, it can be a lot more effective to have several slower computers working on a problem than a single fast one. This raises questions about how much of the computation can be done at the same time.
Here we use a fun team activity to demonstrate an approach to parallel sorting. It can be done on paper, but we like to get students to do it on a large scale, running from node to node in the network.
Networks are everywhere in modern society: roads, wires, water and gas pipes all connect one place to another. Computers are built of networks at many levels, from the microscopic connections between transistors in a chip to the cables and satellites that link the internet around the world. People who build networks often need to work out the most efficient way to make connections, which can be a difficult problem.
This puzzle shows students the decisions involved in linking a network between houses in a muddy city. It can lead to a discussion of minimal spanning tree algorithms for optimizing networks.
Students will begin to understand how functions can be helpful in this fun and interactive Minecraft adventure!
Students will discover the versatility of programming by practicing functions in different environments. Students will recognize reusable patterns and be able to incorporate named blocks to call pre-defined functions.
Students will be able to:- use functions to simplify complex programs.- use pre-determined functions to complete commonly repeated tasks.
Note: You will need to create a free account on code.org before you can view this resource.