Question: Can you plz answer for No . > > 2 only but I will provide the question 1 to get answer 2 . Thank you.
Can you plz answer for No only but I will provide the question to get answer Thank you.
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.
b Create 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
points 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
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
