The Princes in the Tower

May 8th, 2015
Studypool Tutor
Price: $10 USD

Tutor description

One of England's greatest scandals was the disappearance and murder of two princes in 1483. The children of King Edward IV, Edward V and Richard, Duke of York were allegedly "imprisoned" shortly after his death. King Edward's brother, Richard, Duke of Gloucester, secretly wanted the throne for himself.

Word Count: 1323
Showing Page: 1/6
PrefixPrefix and Suffix* A string w is a prefix of a string x, denoted w [ x, if x = wy for some string y in * * In this case, |w| |x|* Example: ab [ abcca* A string w is a suffix of a string x, denoted w ] x, if x = yw for some y in * * Also in this case, |w| |x|* Example: ca ] abcca* The empty string is both a prefix and suffix of every string Nave String Matching Algorithm* Loops to check if P[1..m] = T[s+1..s+m] for each of the n-m+1 possible shifts s * Keeps sliding the pattern along the text and compares corresponding characters * Runtime: O((n-m+1)m)NAVE-STRING-MATCHER(T, P)* 1 n = T.length* 2 m = P.length* 3 for s = 0 to n-m* 4 if P[1..m] == T[s+1..s+m]* 5 print pattern occurs with shift sRabin-Karp Algorithm* To compute p:* p = P[m] + 10(P[m-1] + 10(P[m-2] + + 10(P[2] + 10P[1]))) * To compute t1, t2, , tn-m:* ts+1 = 10(ts 10m-1T[s+1]) + T[s+m+1]* ts+1 = (d(ts T[s+1]h) + T[s+m+1]) mod q* where h dm-1 (mod q)RABIN-KARP-MATCHER(T, P, d, q)* 1 n = T.length* 2 m = P.length* 3 h = dm-1 mod q* 4 p = 0* 5 t0 = 0* 6 for i = 1 to m // preprocessing* 7 p = (dp + P[i]) mod q* 8 t0 = (dt0 + T[i]) mod q* 9 for s = 0 to n-m // matching* 10 if p == ts* 11 if P[1..m] == T[s+1..s+m]* 12 print pattern occurs with shift s* 13 if s < n m* 14 ts+1 = (d(ts T[s+1]h) + T[s+m+1]) mod q Runtime* Preprocessing: (m)* Matching: ((n-m+1)m) in worst case* Usually only have a few valid shift

Review from student

Studypool Student
" Super fast turn around time. Very impressed and will use Studypool again if I need a quick job. Communication was a bit tough but not unbearable. "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1822 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors