Answered step by step
Verified Expert Solution
Question
1 Approved Answer
* * pls use diagrams to explaine problem 1 part a * * Problem Statement You are given string S . Your goal is to
pls use diagrams to explaine problem part a
Problem Statement
You are given string S Your goal is to design an algorithm that creates segments from the
content of the string encoded as follows: if a segment contains a single character repeated n times,
it should be encoded as characternegaaa becomes a and AA becomes A If a
segment contains a mix of unique characters each appearing exactly once it should be encoded
by simply concatenating those characters egabc becomes abc or p becomes p The
algorithm should aim to compress the length of the original string.
Problem Constraints:
Students MUST solve this problem using a Divide and Conquer approach,
only. No credit will be given for other approaches used.
String S contains alphanumeric characters including symbols from the English alphabet.
Letters may be uppercase and lowercase, and may be organized into words.
There may be word spacing between words in string S Words spacing must also be
considered in this problem and must be marked with the symbol $ For example,
will become $ because it has word spacing
The order of the string S must be preserved. For example, aabaa IS NOT ab or
ba Instead, it will become aba
The length of string S is between and
The implementation of the Divide and Conquer approach for this problem MUST BE
recursive.
The algorithm MUST have a constant space complexity of Theta
Input Format:
A string S of size n
Output Format:
A string S of size m where m n
Example:
Input: a string S PPPphhhyssssssssiccccccs issss thhhEEE uuuunIveRRRRssssses
oPPpppeeeeerattttting system.
Output: S Pphysics$is$thE$unIveRses$oPperating$system.
Design an algorithm for this problem using a Divide and Conquer approach.
a Create a stepbystep graphical visualization ie using diagrams of your
solution for this problem using the following string S ImaaaGGinatiooOnn is more
imppppPP ortanNnnn t than knnnnowledge Students are allowed to handdrawn
their solutions for this problem.
bcreate an stepbystep algorithm for this problem in plain english Your
algorithm must work for all the given strings S including empty strings. In addition,
your algorithm must consider all the corner cases that you may encounter in this problem.
Neither code nor pseudocode is allowed in this problem
Pseudocode your algorithm from problem part b Note that your pseudocode
must be understood also by nontechnical readers to get credit for this problem, and it must
be pseudocoded using the Divide and Conquer approach defined by your algorithm
Compute the Theta time complexity of your algorithm:
a Show stepbystep the process to create your T n function from your pseudocode in problem
b Use the Master Theorem to compute the Theta time complexity of your algorithm from your T n function. Show the process stepbystep to get credit
c Prove that the space complexity of your algorithm meets the constraint outlined
in the problem statement constant space complexity Theta
point Find an optimization for your algorithm if any Thats it find a new approach
that will improve the actual time complexity of your algorithm. For this problem, you can use
an approach other than Divide and Conquer. First create an algorithm for your optimization,
secondly compute the time complexity for your optimization, and explain why this new
optimization is better than your original algorithm for this problem. If you are unable to
come up with an optimization for your algorithm, or you believe that it cant be optimized
beyond a Divide and Conquer approach, then explain which other approaches you tried to
optimize your algorithm, and why they didnt work.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started