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.>>2 only but I will provide the question 1 to get answer 2. 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 (character)(n)(e.g.,aaa becomes a3, and AA becomes A2). If a segment contains a mix of unique characters (each appearing exactly once), it should be encoded by simply concatenating those characters (e.g.,abc 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 $4 because it has 4 word spacing
The order of the string S must be preserved. For example, aabaa IS NOT a4b or
ba4. Instead, it will become a2ba2
The length of string S is between 1 and 104.
The implementation of the Divide and Conquer approach for this problem MUST BE
recursive.
The algorithm MUST have a constant space complexity of \Theta (1)
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 sys-tem.
Output: S =P3ph3ys8ic6s$is4$th3E3$6u4nIveR4s4es$oP2p3e5rat5ing$sys-tem.
1.Design an algorithm for this problem using a Divide and Conquer approach.
(a) Create a step-by-step graphical visualization (i.e using diagrams) of your solution for this problem using the following string S =ImaaaGGinat-iooOn0n is more imppppPP ortanNnnn t than knnnnow-ledge. Students are allowed to hand-drawn their solutions for this problem.
(b) Create an step-by-step 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
2.(2 points) Pseudocode your algorithm from problem (1) part (b). Note that your pseudocode must be understood also by non-technical 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!