Download presentation
Presentation is loading. Please wait.
1
Is There Something to CS Theory?
Alan Kaylor Cline July 10, 2009
2
Can one do computer science without doing programming?
3
Can one do computer science
without doing programming? No and Yes
4
How many games are required to determine the winner of
Problem: How many games are required to determine the winner of a single elimination tournament with 18 teams? Single Elimination Tournament: a tournament in which each game involves exactly two teams and after which exactly one is the winner of the game and one is the loser. The tournament proceeds until all but one team has lost.
5
The Pigeonhole Principle
6
The Pigeonhole Principle
Statement Children’s Version: “If k > n, you can’t stuff k pigeons in n holes without having at least two pigeons in the same hole.”
7
The Pigeonhole Principle
Statement Children’s Version: “If k > n, you can’t stuff k pigeons in n holes without having at least two pigeons in the same hole.” Smartypants Version: “No injective function exists mapping a set of higher cardinality into a set of lower cardinality.”
8
The Pigeonhole Principle
Example Twelve people are on an elevator and they exit on ten different floors. At least two got of on the same floor.
9
For a real number x, the ceiling(x) equals
The ceiling function: For a real number x, the ceiling(x) equals the smallest integer greater than or equal to x Examples: ceiling(3.7) = 4 ceiling(3.0) = 3 ceiling(0.0) = 0 If you are familiar with the truncation function, notice that the ceiling function goes in the opposite direction – up not down. If you owe a store 12.7 cents and they make you pay 13 cents, they have used the ceiling function.
10
The Extended (i.e. coolguy)
Pigeonhole Principle Statement Children’s Version: “If you try to stuff k pigeons in n holes there must be at least ceiling (n/k) pigeons in some hole.”
11
The Extended (i.e. coolguy)
Pigeonhole Principle Statement Children’s Version: “If you try to stuff k pigeons in n holes there must be at least ceiling (n/k) pigeons in some hole.” Smartypants Version: “If sets A and B are finite and f:A B, then there is some element b of B so that cardinality(f -1(b)) is at least ceiling (cardinality(B)/ cardinality(A).”
12
The Extended (i.e. coolguy) Pigeonhole Principle
Example Twelve people are on an elevator and they exit on five different floors. At least three got off on the same floor. (since the ceiling(12/5) = 3)
13
The Extended (i.e. coolguy) Pigeonhole Principle
Example Twelve people are on an elevator and they exit on five different floors. At least three got off on the same floor. (since the ceiling(12/5) = 3) Example of even cooler “continuous version” If you travel 12 miles in 5 hours, you must have traveled at least 2.4 miles/hour at some moment.
14
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies.
15
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies.
16
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies. F F F
17
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies. E E E
18
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies.
19
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies. How would you solve this? You could write down every possible acquaintanceship relation.
20
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies. How would you solve this? You could write down every possible acquaintanceship relation. There are 15 pairs of individuals. Each pair has two possibilities: friends or enemies. That’s 215 different relations.
21
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies. How would you solve this? You could write down every possible acquaintanceship relation. There are 15 pairs of individuals. Each pair has two possibilities: friends or enemies. That’s 215 different relations. By analyzing one per minute, you could prove this in 546 hours.
22
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies. Could the pigeonhole principle be applied to this?
23
Application 1: Among any group of six acquaintances
there is either a subgroup of three mutual friends or three mutual enemies. Could the pigeonhole principle be applied to this? I am glad you asked. Yes.
24
Begin by choosing one person:
* Begin by choosing one person: *
25
* * Begin by choosing one person: Five acquaintances remain
These five must fall into two classes: friends and enemies
26
* * Begin by choosing one person: Five acquaintances remain
These five must fall into two classes: friends and enemies The extended pigeonhole principle says that at least three must be in the same class - that is: three friends or three enemies
27
Suppose the three are friends of :
* Suppose the three are friends of : * ? ? ?
28
* * Suppose the three are friends of :
Either at least two of the three are friends of each other… * ? ?
29
* * Suppose the three are friends of :
Either at least two of the three are friends of each other… * ? ? In which case we have three mutual friends.
30
* * Suppose the three are friends of :
Either at least two of the three are friends of each other… or none of the three are friends *
31
* * Suppose the three are friends of :
Either at least two of the three are friends of each other… or none of the three are friends * In which case we have three mutual enemies.
32
Similar argument if we suppose the three are enemies of .
* Similar argument if we suppose the three are enemies of . * ? ? ?
33
Application 2: Given twelve coins – exactly eleven of which have equal weight determine which coin is different and whether it is heavy or light in a minimal number of weighings using a three position balance. H
34
OUR SOLUTION
35
Application 3: In any sequence of n2+1 distinct integers, there is
a subsequence of length n+1 that is either strictly increasing or strictly decreasing n=2: 3,5,1,2, ,3,5,4,1 n=3: 2,5,4,6,10,7,9,1,8, ,1,6,3,8,9,2,4,5,7 n=4: 7,9,13,3,22,6,4,8,25,1,2,16,19,26, 10,12,15,20,23,5,24,11,14,21,18,17
36
Application 3: In any sequence of n2+1 distinct integers, there is
a subsequence of length n+1 that is either strictly increasing or strictly decreasing n=2: 3,5,1,2, ,4,5,3,1 n=3: 2,5,4,6,10,7,9,1,8, ,1,6,3,8,9,2,4,5,7 n=4: 7,9,13,3,22,6,4,8,25,1,2,16,19,26, 10,12,15,20,23,5,24,11,14,21,18,17
37
Application 3: In any sequence of n2+1 distinct integers, there is
a subsequence of length n+1 that is either strictly increasing or strictly decreasing Idea: Could we solve this by considering cases? For sequences of length 2: 2 cases For sequences of length 5: 120 cases For sequences of length 10: 3,628,800 cases For sequences of length 17: cases For sequences of length 26: cases For sequences of length 37: cases
38
The Limits of Computation
Speed: speed of light = m/s Distance: proton width = 10 –15 m With one operation being performed in the time light crosses a proton there would be operations per second. Compare this with current serial processor speeds of operations per second
39
The Limits of Computation
With one operation being performed in the time light crosses a proton there would be operations per second. Big Bang: 14 Billion years ago … that’s seconds ago So we could have done operations since the Big Bang. So we could not have proved this (using enumeration) even for the case of subsequences of length 7 from sequences of length 37.
40
But with the pigeon hole principle we can prove it in two minutes.
41
We can apply the pigeon hole principle to a sorting problem
42
We can apply the pigeon hole principle to a sorting problem
How many comparisons are required to sort n distinct elements?
43
Think of a sorting algorithm as determining
in which permutation that an array is presented
44
is presented as the permutation: 3, 1, 4, 2, 5
Think of a sorting algorithm as determining in which permutation that an array is presented The array: 2, -5, 6, 0, 12 is presented as the permutation: 3, 1, 4, 2, 5
45
is presented as the permutation: 3, 1, 4, 2, 5
Think of a sorting algorithm as determining in which permutation that an array is presented The array: 2, -5, 6, 0, 12 is presented as the permutation: 3, 1, 4, 2, 5 Thus the problem of sorting is equivalent to determining in which of the n! permutations an array is presented
46
In terms of functions, the sorting algorithm is a function with
n! possible different inputs that must act differently on each
47
In terms of functions, the sorting algorithm is a function with
n! possible different inputs that must act differently on each Think of the various permutations as leaves at the bottom of a binary tree with comparisons at the internal nodes of the tree. A tree of height k (i.e. with at most k comparisons to reach any leaf) has at most 2k leaves.
48
In terms of functions, the sorting algorithm is a function with
n! possible different inputs that must act differently on each Think of the various permutations as leaves at the bottom of a binary tree with comparisons at the internal nodes of the tree. A tree of height k (i.e. with at most k comparisons to reach any leaf) has at most 2k leaves. Thus, we must have
49
In terms of functions, the sorting algorithm is a function with
n! possible different inputs that must act differently on each Think of the various permutations as leaves at the bottom of a binary tree with comparisons at the internal nodes of the tree. A tree of height k (i.e. with at most k comparisons to reach any leaf) has at most 2k leaves. Thus, we must have or equivalently
50
We have shown that the minimum number of comparisons for a comparison based sorting algorithm is
51
Have you seen this presented as
We have shown that the minimum number of comparisons for a comparison based sorting algorithm is Have you seen this presented as
52
Have you seen this presented as
We have shown that the minimum number of comparisons for a comparison based sorting algorithm is Have you seen this presented as For large values of n these are close, but they are certainly not identical
53
vs. vs. mergesort
54
What is the volume of the largest sphere that can be fit
Problem: What is the volume of the largest sphere that can be fit between a unit radius cylinder adjoining a floor and a wall?
55
What is the volume of the largest sphere that can be fit
Problem: What is the volume of the largest sphere that can be fit between a unit radius cylinder adjoining a floor and a wall? so the volume is Radius is
56
How should we calculate
if we use
57
How should we calculate
Some alternatives: if we use expression computed as relative error double precision error multiple 2.51% 103. 5.95% 137. 15.47% 339. % 71,791. 1.05% 35. 0.44% 18. 0.15% 1.
58
How should we calculate
? Some alternatives: expression computed as relative error double precision error multiple 2.51% 103. 5.95% 137. 15.47% 339. % 71,791. 1.05% 35. 0.44% 18. 0.15% 1.
59
How should we calculate
? Some alternatives: expression computed as relative error double precision error multiple 2.51% 103. 5.95% 137. 15.47% 339. % 71,791. 1.05% 35. 0.44% 18. 0.15% 1.
60
double precision error multiple
How should we calculate ? Some alternatives: expression computed as relative error double precision error multiple 2.51% 103. 5.95% 137. 15.47% 339. % 71,791. 1.05% 35. 0.44% 18. 0.15% 1.
61
An easy way to approximate pi is to construct a sequence of inscribed
regular polygons of 2n sides We have: and for n = 2, 3, … :
94
algebraically equivalent
Let’s use this algebraically equivalent version of the formula for : and for n = 2, 3, … :
96
.
97
.
101
The steps of scientific computation
Observation of nature Construction of a mathematical model Selection of a computational method to solve the mathematical formulation Program the method Execute the program and display the results Interpret the results and compare to observations (Possibly) Refine
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.