{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

2c03-review - 00015 - of C To check it we can use KMP...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
5 else begin z:=x mod y; if z=0 then gcd:=y else begin push((x,y,1),S); goto 0; end end 1: if not empty(S) then (x,y,1) := top (S); pop(S); goto 1; end 6.[10] Construct the string C=AA. Then B is a cyclic shift of A if and only if B is a substring
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: of C. To check it we can use KMP algorithm. The complexity is O(|C|+|B|) = O(2n+n)= O(3n)=O(n)....
View Full Document

{[ snackBarMessage ]}