In a long list of names, one of the names appears more than half of the time. You will be read the names one at a time, without knowing how many they are, and without being able to write them down. If you have a very weak memory, how can you figure out which is the majority name?
Remember the first name and then keep track of whether it has been repeated more than half of the time. To do that, simply add 1 if you hear the name or subtract one when you hear another name. If the list finishes and your counter is positive, then the first name is the majority. If your counter drops to 0, simply restart the procedure with the next name you hear.
This algorithm, invented by R. Boyer and J. Moore, works, because if the counter ends up at 0, then each of the names up to that moment has been read at most half of the time. Therefore, the majority name appears more than half of the time in the remainder of the list.
Consider all 1024 vectors in a 10-dimensional space with elements ±1. Show that if you change some of the elements of some of the vectors to 0, you can still choose a few vectors, such that their sum is equal to the 0-vector.
Denote the 1024 vectors with ui and their transformations with f(ui). Create a graph with 1024 nodes, labeled with ui. Then, for every node ui, create a directed edge from ui to ui-2f(ui). This is a valid construction, since the vector ui-2f(ui) has elements -1, 0, and 1 only. In the resulting graph, there is a cycle:
v1 ⇾ v2 ⇾ … ⇾ vk ⇾ v1.
Now, if we pick the (transformed) vectors from this cycle, their sum is the 0-vector:
There are 5 houses and each of them has a different color. Their respective owners have different heritages, drink different types of beverages, smoke different brands of cigarettes, and look after different types of pets. It is known that:
The Brit lives in the red house.
The Swede keeps dogs as pets.
The Dane drinks tea.
Looking from in front, the green house is just to the left of the white house.
The green house’s owner drinks coffee.
The person who smokes Pall Malls raises birds.
The owner of the yellow house smokes Dunhill.
The man living in the center house drinks milk.
The Norwegian lives in the leftmost house.
The man who smokes Blends lives next to the one who keeps cats.
The man who keeps a horse lives next to the man who smokes Dunhill.
The owner who smokes Bluemasters also drinks beer.
The German smokes Prince.
The Norwegian lives next to the blue house.
The man who smokes Blends has a neighbor who drinks water.
The question is, who owns the pet fish?
The German owns the pet fish.
Since the Norwegian lives in the leftmost house (9) and the house next to him is blue (14), the second house must be blue. Since the green house is on the left of the white house (4), the person living in the center house drinks milk (8), and the green house’s owner drinks coffee (5), the fourth house must be green and the fifth one must be white. Since the Brit lives in the red house (1) and the Norwegian lives in the leftmost house (9), the leftmost house must be yellow and the center house must be red. Therefore, the colors of the houses are: YELLOW, BLUE, RED, GREEN, WHITE.
Since the Norwegian from the yellow house smokes Dunhill (7), the man from the blue house must keep a horse (11). The person smoking Blends cannot be in the red house, because this would imply that the person in the green house keeps cats and the Swede keeps dogs in the white house (2, 10). However, in this case the Dane must be drinking tea in the blue house (3) and the person smoking Blends does not have a neighbor drinking water (5), which is a contradiction (15). Also, the person smoking Blends cannot be in the green house, because this would imply that the person in the white house drinks water (15), the Dane lives in the blue house (3), and the German and the Swede live in the last two houses. Since the German smokes Prince (13) and the Swede keeps dogs (2), there is nobody who could smoke Bluemaster and drink beer (12). The person smoking Blends cannot be in the white house either, because this would imply that the person in the green house drinks water (15), when in fact he drinks coffee (5).
Therefore, the person smoking Blends must be in the blue house, and then the German and the Swede must live in the last two houses (2, 13). Since the person who smokes Bluemasters drinks beer (12), this must be the Swede with his dogs in the white house (2). The only option for the person who smokes Pall Mall and raising birds (6) is the red house. Then the Norwegian must keep cats (10) and the German is left with the pet fish in the green house.
Alex and Bob are playing a game. They are taking turns drawing arrows over the segments of an infinite grid. Alex wins if he manages to create a closed loop, Bob wins if Alex does not win within the first 1000 moves. Who has a winning strategy if:
a) Alex starts first (easy) b) Bob starts first (hard)
Remark: The loop can include arrows drawn both by Alex and Bob.
In both cases, Bob wins. An easy strategy for part a) is the following:
Every time Alex draws an arrow, Bob draws an arrow in such a way, that the two arrows form an L-shaped piece and either point towards or away from each other. Since every closed loop must contain a bottom left corner, Alex cannot win.
For part b), Bob should use a modification of his strategy in part a). First, he draws a horizontal arrow. Then, he splits the remaining edges into pairs, as shown on the image below. If Alex draws one arrow on the grid, then Bob draws its paired arrow, such that the two arrows point either towards or away from each other. The only place where a loop can have a bottom left corner is where Bob drew the first arrow. However, if a loop has a bottom left corner in this positio, then it must have at least one more bottom left corner, which is impossible.
Bob and Jane are taking turns, placing knights and coins respectively on a chessboard. If Bob is allowed to place a knight only on an empty square which is not attacked by another knight, how many pieces at most can he place before running out of moves? Assume that Jane starts second and plays optimally, trying to prevent Bob from placing knights on the board.
Bob can place at most 16 knights. One way to do this is to keep placing knights only on the 32 white squares. In order to see that Jane can prevent Bob from placing more than 16 knights, split the board in four 4×4 grids. Then, group the squares in each grid in pairs, as shown on the image below. If Bob places a knight on any square, then Jane will place a coin on its paired square. This way Bob can place at most one knight on each of the four red squares, one knight on each of the four green squares, one knight on each of the four brown squares, and one knight on each of the four blue squares. Therefore, he can not place more than 64/4 = 16 knights on the board.
There are three light bulbs in your attic. All of them are turned off and their switches are installed downstairs. You can play with the switches as much as you want and after that, you can visit the attic above just once. How can you find out which switch to which bulb corresponds?
You turn the first switch on, then wait for 30 minutes and turn the second switch on. After that go upstairs and examine the bulbs. The one which is turned off corresponds to the third switch. The one which is turned on and is still cold corresponds to the second switch. The one which is turned on and is hot corresponds to the first switch.
100 coins are placed on a rectangular table, such that no more coins can be added without overlapping. Show that you can cover the entire table with 400 coins (overlapping allowed).
Since we can not place any more coins on the table, each point of it is at distance at most 2r from the center of some coin, where r is the radius of the coin. Now shrink the entire table twice in width and length, then replace every shrunk coin with a full sized one. This way the small table will be completely covered because every point of it will be at distance at most r from the center of some coin. Add three more of these smaller tables, covered with coins, to create a covering of the big table.
Borromean rings are rings in the 3-dimensional space, linked in such a way that if you cut any of the three rings, all of them will be unlinked (see the image below). Show that rigid circular Borromean rings cannot exist.
Assume the opposite. Imagine the rings have zero thickness and reposition them in such a way, that two of them, say ring 1 and ring 2, touch each other in two points. These two rings lie either on a sphere or a plane which ring 3 must intersect in four points. However, this is impossible.