COMP 2711H: Lecture 5
Date: 2024-09-09 17:57:10
Reviewed:
Topic / Chapter: Practice Problems
summary
❓Questions
Notes
Even More Problems
-
Problem 1
- prison guard
- prisoner gets to assigned a number ()
- they know what number they were assigned
- and
- can say: 1 sentence, only once
- "I know out number and it's (n,m)"
- show that: they will be able to come to an answer
- :
- base case:
- one with 0 can immediately shout out
- solved on day 1
- base case:
- if either number was 0, the prisoner would have said
- however, if no one shouted it on day 1, prisoner w/ no. 1 can know that his/her number is the min. and the other no. is
- solved on day 2
- : if , then it will be announced on day
-
- as, if it was , then it would have been announced on day
- it wasn't the case, so the prisoner with can announce on day
-
Problem 1'
- a prisoner: supposed to be executed
- someday next week, but not known
- 👨🏫 and you will be surprised
- prisoner: cannot be executed on Sunday
- as he won't be surprised on that day
- prisoner: cannot be executed on Saturday
- as he won't be surprised to be so by the end of Friday
- and so on...
- prisoner: I ought not to be executed!
- answer: he was executed on Wednesday, and he was surprised
-
Problem 2
- 2d lattice: all points of form where
- for each point: has natural number written on it
- number written on point: will be mean of its neighbors
- neighbor: i.e. on m
- prover all the number are equal
- proof by well ordering
- all numbers assigned to points
- has a minimum value
- and the minimum value's neighbors: must all be
- unless: there must be a neighbor that is bigger than
- then there also must be a neighbor with natural number smaller than , too
- all numbers assigned to points
-
Problem 3
- there is a circle w/ circumference 1
- and there are cars on its circumference
- and each can go distance , and fuel can be shared
- if , there exists a car that can catch & steal others' fuel, and make a full round
- base case:
- with only 1 car, w/ , then the car can make a whole round
- or:
- induction case:
- : denotes distance till the next car
- there exists at least 1, "good" car that can catch another car ()
- however, it doesn't mean that the car can make a whole round after the catch
- 👨🏫 idea: removing the "good" car, and making it with cars only
- remove the good car , and eliminate
- and change fuel of car to
- intuition: if a car could reach car , then it can reach car with this wormhole & fuel change
- 👨🎓 it is, kind of equivalent, considering car is a "good" car
- and, still, this subproblem w/ cars: satisfy
- ⭐👨🏫 we don't get to choose the instance of cars, as we must show it holds for all combinations
- however, we can do so for cars, as it is the assumption we are having
-
Problem 4
- there are no four positive integers s.t.
- proof by contradiction
- assume: assignment s.t. making minimum exists
-
- RHS: multiple of 3
- LHS: must also be multiple of 3
- and sum of two such numbers: must be within
- and only occurs when both numbers are multiple of 3
- if
- if
- and : smaller then , clearly
- contradiction: thus no such solution exists
- assume: assignment s.t. making minimum exists
- there are no four positive integers s.t.
-
Problem 5
- graph problem: a country w/ cities
- and exactly 1 road between any two cities
- and all are 1-way
- a city : a central city
- if every other city can reach directly / or with 1 stop
- show that there exists at least 1 central city
- proof by induction
- : it works
- for city: all other cities will have road to
- or other city that has road to
- by adding a new city
- if has road to : remains the central
- if has road to :
- if has any road to 's first neighbor: remains the central
- else:
- and first neighbors of : has direct road to
- second neighbors of : can access through first neighbors
- is the new central
- extremal proof
- count: how many roads are coming in
- such count:
- i.e.
indegree
- if : a city w/ maximal indegree
- then is the capital
- proof
- there are first neighbor cities of
- and other cities
- if it has road to first neighbors: can access in two steps
- doesn't make not-a-capital
- if it has road to first neighbors: can access in two steps
- is not capital only when:
- and all first neighbors are towards a different city
- 👨🎓 as: if that city had road towards any of first neighbors / , it can reach easily
- must be the other direction
- i.e. if had indegree, new city has at least indegree
- 👨🎓 as: if that city had road towards any of first neighbors / , it can reach easily
- however, it's a contradiction in choice of
- as is supposed to be a city w/ maximal indegree
- and all first neighbors are towards a different city
- count: how many roads are coming in