University of Waterloo Logo and CEMC Banner

2023 Beaver Computing Challenge
(Grade 5 & 6)

Questions, Answers, Explanations, and Connections


Part A

Beaver Hats

Five hats are hanging as shown.

Hat P is the second shortest hat. Hat Q is
the tallest hat. Hat R is the shortest hat. Hat S is the third tallest
hat. Hat T is the second tallest hat.

Question

In what order should the hats be rehung so that they get taller as you move left to right?

  1. \(R,P,S,T,Q\)
  2. \(Q,S,T,P,R\)
  3. \(R,P,T,S,Q\)
  4. \(T,Q,S,P,R\)

Answer

(A) \(R,P,S,T,Q\)

Explanation of Answer

If we order the hats so that they get taller as you move left to right, the result is as shown below.

The hats are placed in the order R, P, S, T,
and Q, from left to right.

Connections to Computer Science

In computer science, arranging elements into an ordered sequence is called sorting. Sorting is one of the most fundamental problems in computer science. There are many uses of sorting: when clothes are arranged by size and colour in a store, or when the sports standings are shown in descending order. Having data in sorted order helps us make important observations about the data more quickly, such as finding the biggest value, or smallest value, or the top three values, or the middle value, etc.

There are many algorithms to sort elements. An algorithm is a process to accomplish some task. Many sorting algorithms rely on two basic principles: comparing the relative size of two values, and swapping (or exchanging the positions of) those elements. For the original order of the hats, try to think of a process to compare and swap the hats to put them into sorted order.

Country of Original Author

Lithuania

Flower Garden

Beaver Bai has a garden with 9 fence posts around the edge, as shown.

He uses yellow ropes to divide the garden into smaller sections, according to the following rules:

Question

Which of the following gardens below could Bai have made?