← All problems

2021 · open round · H · 5 points

Sequitur

Pranav Krishna & Daniel Lovsted · syntax · formal and computational

Space is valuable, so it's often desirable to compress data — that is, to use less space to convey the same information. One common data compression strategy is to identify repeated patterns within the data and somehow consolidate these repetitions.1 First, let's look at Sequitur, a fast compression algorithm that uses the repeated pattern strategy. The table below shows Sequitur running on the input “abcdbcabcd”, with its output at the very bottom:

Step NumberColumn 1Column 2
1)aS = a
2)abS = ab
3)abcS = abc
4)S = abcd
5)abcdb
6)abcdbcS = abcdbc
aXdXS = aXdX
X = bc
7)
8)aXdXab
X = bc
9)aXdXabcS = aXdXabc
X = bc
aXdXaXS = aXdXaX

X = bc
Y = aX
10)
X = bc
Y = aX
ZXZS = ZXZ
X = bc
Y = aX
Z = Yd
S = ZXZ; X = bc; Y = aX; Z = Yd

1 It just so happens that identifying repeated patterns in a human language can tell us a lot about how that language works. If you want to know more about how linguists (and especially computational linguists) use compression in language technologies, try problem (I), Non Sequitur, in this booklet. Be aware, however, that solving problem (I) will not give you any advantage in solving this problem.

H1. Fill in the blanks (marked with bolded letters) in the table above.

Next, take a look at Byte Pair Encoding (BPE), a widely used compression algorithm that also uses the repeated pattern strategy. Like in the previous example, BPE is running with an input of “abcdbcabcd”, and its output is shown at the bottom of the table:

Step NumberColumn 1Column 2
1)abcdbcabcdS = abcdbcabcd
2)
X = bc
3)YdXYdS = YdXYd
X = bc
4)ZXZS = ZXZ
X = bc
Y = aX
Z = Yd
S = ZXZ; X = bc; Y = aX; Z = Yd

H2. Fill in the blanks (marked with bolded letters) in the table above.

As you can see, for the input “abcdbcabcd”, Sequitur and BPE produce the same output! But this isn't always the case.

H3. For each of the following inputs, say whether Sequitur and BPE give the same or different outputs:

  1. abcabdbcbc
  2. abbcaddca
  3. bacbcbabacbcba
  4. ccdbccdbccacc
  5. ccdbccdbccaccacca

The rest of the questions are below, under Questions.

TimerOptional. Set whatever limit suits you.

Questions

0 of 19 correct
H3

For each of the following inputs, say whether Sequitur and BPE give the same or different outputs.

a) abcabdbcbc
b) abbcaddca
c) bacbcbabacbcba
d) ccdbccdbccacc
e) ccdbccdbccaccacca

Explanation

Try the questions first. Use the Hint button next to any part if you need a nudge.

Reading the explanation costs no XP. Worth 5 points in the real exam.