2021 Beaver Computing Challenge
(Grade 7 & 8)
Questions, Answers, Explanations, and Connections
A beaver is photographing butterflies, but after each photo is taken, half the butterflies fly away.
The first photo has 64 butterflies in it and the last photo has 2 butterflies in it.
How many photos did the beaver take?
(A) 6
We are told that the first photo has 64 butterflies in it. Since half the butterflies fly away after each photo is taken, we can record how many butterflies are in each photo.
Photo Number | Number of Butterflies |
---|---|
1 | 64 |
2 | 32 |
3 | 16 |
4 | 8 |
5 | 4 |
6 | 2 |
We see that the photo with 2 butterflies in it is photo number 6. Therefore, the beaver took 6 photos.
In order to move from 64 butterflies to one butterfly, we need to cut
the number in half 6 times. If we started with 128 butterflies, we would
need to cut the number in half 7 times before reaching one butterfly,
and if we started with 256 butterflies we would need to cut the number
in half 8 times before reaching one butterfly.
This process of cutting by half each time decreases the problem size
exponentially. There are many natural processes
that either grow or shrink exponentially: how an invasive species
spreads and how a radioactive element decreases its radioactivity are
two examples. This idea is used by computer scientists to design
algorithms which use the divide and
conquer technique: each major step of the algorithm reduces
the size of the problem by half. These sorts of algorithms are very
efficient because they can take very large inputs
and produce an answer very quickly. One famous example of this idea is
binary search in a sorted list of elements.
Canada
Emil has six different coins.
Emil placed the six coins on a table, one at a time. Some coins were placed on top of other coins so that they overlap as shown.
Which coin was the fourth coin that Emil placed on the table?
(B)
To determine the correct answer, we reverse the process.
Notice that the coin in the bottom-left corner is the only coin that has no other coins on top of it. This means it must have been placed on the table last and was therefore the sixth coin to be placed. Before this coin was placed, the coins on the table must have looked like this:
Now the only coin that has no other coins on top of it is the coin . This coin must have been placed second to last and was therefore the fifth coin to be placed. Before this coin was placed, the coins on the table must have looked like this:
Now the only coin that has no other coins on top of it is the coin . This coin must have been placed third to last and was therefore the fourth coin to be placed.
Continuing this process, we find that the coins were placed on the table in the following order:
The coins in the picture are laid in a sequence, and the order of the sequence matters.
There are many sequences where the order matters. For example, when getting dressed, putting on shoes should come after putting on pants.
Another example is describing to a computer how to draw a picture. Drawing a circle, then two dots, and then a curved line, will produce a smiley face, as shown in the picture below.
If the order was different, and the circle was drawn last, the two dots and curved line would have been hidden behind the circle.
Computers internally usually also work sequentially. Most computer programs are written so that first one action and then another action happens. So a computer program for drawing a smiley face could look like this:
Czech Republic
A board is divided into squares and a different object is placed in each square as shown.
A swap exchanges the locations of two objects. Three swaps occur in this order:
What is the location of after the last swap?
(A)
Here is the state of the board after each swap:
If you compare the locations of the objects at the beginning, with the locations of the objects after the last swap, you can see that the star is now in the original location of the flower.
Another way to see this final result is to think about trading goods at a market. Suppose you bring a flower and you trade it for a tree. Then you trade your tree for a ladybug. Then you trade your ladybug for a star. The item you end up with is the same as if you traded your flower for a star directly.
This task focuses on the concept of swapping values between two variables. In computer programming, a variable is a memory location that can hold information. Swapping involves exchanging the values of two variables.
For example, suppose A is a variable that holds the value “18” and B is another variable that holds the value “42”. After a swap, variable A will hold “42” and variable and B will hold “18”.
In most programming languages, a temporary variable is needed to swap values between two variables. For example, if there was a temporary variable T, the following three steps would swap the values between A and B:
One of the most common uses of swapping in computer science is in sorting, where a collection of data it put into either ascending or descending order.
India
A genetic scientist is conducting experiments. Each experiment involves a condition followed by a sequence of letters. The condition includes two numbers and a target letter. An experiment is flagged if the number of times the target letter appears in the sequence is between the two numbers (inclusive).
This experiment is flagged because the number of times the target letter A appears in the sequence ATGC is 1 which is between 1 and 2 (inclusive).
This experiment is not flagged because the number of times the target letter T appears in the sequence ATGT is 2 which is not between 3 and 8 (inclusive).
How many of the following four experiments will be flagged?
(C) 3
The first experiment is flagged because the number of times the target letter T appears in the sequence T T T T T T T is 7 which is between 2 and 8 (inclusive).
The second experiment is not flagged because the number of times the target letter C appears in the sequence A G C T A C T A C is 3 which is not between 1 and 2 (inclusive).
The third experiment is flagged because the number of times the target letter A appears in the sequence T C G C T G C is 0 which is between 0 and 2 (inclusive).
The fourth experiment is flagged because the number of times the target letter G appears in the sequence G A T G T A G C T is 3 which is between 1 and 3 (inclusive).
Three of the four experiments are flagged.
The concept of pattern recognition is a very important one in computer science. The key goal of pattern recognition is to determine if some input, perhaps text or an image, matches or contains a particular pattern. For example, given a large body of text, such a collection of textbooks or entire webpages, determine if a certain word or phrase appears.
DNA can be described as a very long sequence of the letters A, C, G, T. In humans, there are about 3 billion such letters describing DNA. A particular pattern would be a sequence of letters that is known to indicate a certain genetic condition, such as an increased likelihood of a specific disease.
One very common technique to describe patterns in text is the use of regular expressions. An example of a regular expression for Canadian Postal codes would be (A-Z)(0-9)(A-Z)(0-9)(A-Z)(0-9). This expression indicates that the first, third, and fifth characters must be uppercase letters, and the second, fourth, and sixth characters must be a single digit. Regular expressions like this are used in text editors for advanced “search and replace” functions.
Portugal
In the map shown, Dino can follow roads and can climb up and over volcanoes unless they are erupting.
Because two volcanoes are erupting, Dino cannot get from point \(P\) to point \(Q\).
Which two volcanoes are erupting?
(D) Volcanoes 2 and 4
Since Dino cannot climb up and over an erupting volcano, a road to or a road from an erupting volcano is not helpful (at least up to the point where it intersects another road).
In the following image all roads to and from volcanoes 2 and 4 have been removed. Notice that in this situation it is not possible for Dino to get to point \(Q\) from point \(P\).
Using the same approach we can see that a route from \(P\) to \(Q\) does exist for the other three options.
Erupting Volcanoes | Map | Route (from \(P\) to \(Q\)) |
---|---|---|
1 and 2 | Route over volcano 4 exists | |
3 and 4 | Route over volcano 2 exists | |
1 and 4 | Route over volcano 2 exists |
In computer science, this type of diagram is called a graph. The volcanoes are the vertices and the roads connecting the volcanoes are the edges of the graph.
In the initial graph, points P and Q are connected: there is a sequence of edges, known as a path, that leads between P and Q.
This task is concerned with finding a set of cut vertices, which are also known as articulation points. A set of cut vertices has the property that when those vertices and all of the edges attached to those vertices are removed, the graph will become disconnected.
In this problem, no single vertex is a cut vertex: removing just one of the four vertices will not disconnect the graph. However, removing Volcanoes 2 and 4 will disconnect the graph.
One crucial use of finding cut vertices is for determining the fault tolerance of a network system: finding the number of routers or servers that would need to go down/offline before some computers in the network can no longer connect to each other.
Romania
In a forest, there are seven towers and eight paths. Each path connects two towers as shown.