Question: Let X [ 1 : n ] be an array of characters. A run is any maximal sequence of consecutive identical elements in the array,
Let X : n be an array of characters. A run is any maximal sequence of consecutive identical
elements in the array, and the length of a run is the number of entries in it Each run is
represented as a triplet ija where i is the index of the starting element of the run, j is the index
of the ending element of the run, and is the repeating character of the run. For example, in the
array
the runs are: represented as represented as
represented as and represented as
a Write a divideandconquer algorithm that takes as input a character array X : n and
returns a list of the ija triplets for the runs in the input array. Analyze the time complexity
of your algorithm. Your algorithm should split the input into two halves
b Write a divideandconquer algorithm that returns the longest run in an input real array.
Analyze the time complexity of your algorithm. Your algorithm should split the input into
two halves, and must not use the output of the algorithm of part a
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
