![]() |
28th June
July 30, 2008 on 9:16 pm | In Code | | Jeremy ReadWatched a world war two doco, it’s interesting. Watch it.
Another game for you to enjoy: Noodles
Up/Down/Left/Right for movement. R restarts the level. There’s only eight levels.
I’ll post the source code for you later.
CS750 Notes:
RELPRIME = { <x,y> | x and y are relatively prime }
Theorem REPRIME ∈ P
Proof: To show Euclid’s GCD algorithm is in P , this suffices since x and y are relatively prime iff GCD(x,y) = 1
Algorithm:
Input <x,y> where x,y are binary non-negative integers
If y = 0 return x
Else return GCD(y, x mod y)
Example: GCD(26,38)
GCD(26,38) = GCD(38, 26 mod 38)
GCD(38, 26) = GCD(26, 38 mod 26)
GCD(26, 12) = GCD(12, 26 mod 12)
GCD(12,2) = GCD(2, 12 mod 2)
GCD(2,0) = 2=> not relatively prime
Proof: Need to show there are O(poly(lg (x * y ) ) recursive calls since inpute size is lg x + lg y
Note after first call to GCD assigns x > y
Thus x decreases on each call after that (since x mod y < y , y is also strictly decreasing)
To complete the proof we show that x is halved every two calls, that is O(lgx) recursive calls to computer GCD.
If x >= 2y then x’ <= x /2 (halved in one step)
Else x<2y then y’ = x mod y = x - y < x - x/2 = x/2
Since y > x /2
Therefore step two swap positions thus x” < x / 2 (two steps)
Thus halved every two steps at most.
Definition: A language is in NP if it is decided by some NTM in polynomial time.
Example: HAMPATH = { <G,s,t> | where G is a diagraph with a hamilton path from s to t}
Theorem HAMPATH ∈ NP
Proof: The following NTM decides hamilton path.
mark[i] = 0 for all i ∈ V(G)
mark[s] 1; v = s
for n - 1 iterations do
{
non deterministic pick u ∈ V (G)
if mark[u] != 0 or (v,u) !∈ E(G)
v = u ; mark[v] = !
}
if v = T accept
else reject
Definition: A verifier for a language A is a deterministic algorithm V where L = { x | V accepts <x,w> for some string w}
- w is called the witess of proof (certificate)
- |w| of poly-length of x
- The time of a verifier runs in is with respect to |x|
7 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
You must be logged in to post a comment.
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^

Do you think it will work?
Comment by DarkSentinel — 10:43 pm — July 30, 2008 #
What’ll work?
Comment by Jeremy Read — 11:00 pm — July 30, 2008 #
Putting course notes on PLT1 under the guise of ‘content’. And that content = hits = money
Comment by DarkSentinel — 11:12 am — July 31, 2008 #
I could put it under a sub-project page. Ideas?
Comment by Jeremy Read — 1:41 pm — July 31, 2008 #
Totally violate all copyright of the uni and put up notes for all papers the uni offers? We could possibly do this
Comment by DarkSentinel — 10:44 pm — August 1, 2008 #
We can put up our own notes. We just can’t put up Uni’s.
Comment by Jeremy Read — 12:16 pm — August 2, 2008 #
Yeah but a lot of peoples’ notes will be verbatim quotes by the lecturers/of lecturers’ material.
Comment by DarkSentinel — 7:12 pm — August 2, 2008 #