ex09 - the text string may be read and compared to a...

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

View Full Document Right Arrow Icon
Algorithms - Exercise 9 TA in charge: Dvir 1. Assume that the fastest algorithm for multiplying two polynomials of degree n over a Feld F works in time M ( n ), and that the fastest algorithm for computing the square of a given polynomial of degree n over F works in time S ( n ) = Ω( n ). Assume that in F there holds 1 + 1 n = 0. Show that M ( n ) = Θ( S ( n )). 2. Given the coe±cients of a polynomial P ( x ) over the reals of degree n , describe an O ( n log n ) algorithm that computes the coe±cients of the polynomial P ( x + a ). Hint: Start by writing an explicit expression for the coe±cients of P ( x + a ). 3. (a) Construct the string-matching automaton for the pattern P = aabab and illustrate its operation on the text string T = aaababaabaababaab over the alphabet Σ = { a, b } . (b) Compute the KMP preFx function π for the pattern ababbabbababbababbabb over the alphabet Σ = { a, b } . (c) Recall the KMP algorithm. Bound from above the number of times each character from
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the text string may be read and compared to a pattern character. Show your bound to be tight. 4. Describe a linear time algorithm that decides whether a given string S is a cyclic shift of a given string T (for example ’liccyc’ is a cyclic shift of ’cyclic’ ). 5. (Relatively hard) Let y i denote the concatenation of a string y with itself i times. ²or example ( ab ) 3 = ababab . We say that a string x has a repetition factor r if x = y r for some string y and r > 0. let ρ ( x ) denote the largest r such that x has repetition factor r . Give an e±cient algorithm that takes as input a pattern P [1 ...n ] and computes for all its preFxes P i the value ρ ( P i ) ( P i = P [1 ...i ]). What is the running time of your algorithm? 1...
View Full Document

This note was uploaded on 03/08/2010 for the course ENGINEERIN 50-22-43-2 taught by Professor Prizler during the Spring '10 term at Tel Aviv Uni..

Ask a homework question - tutors are online