Hi!
Below are mentioned the 6 worst case scenerios since we will be having cases as :
>>> print(compress('ABCAAAACBA')) {'AB': 256, 'BC': 257, 'CA': 258, 'AA': 259, 'AAA': 260, 'AC': 261, 'CB': 262, 'BA': 263} [65, 66, 67, 65, 259, 65, 67, 66, 65] >>> print(compress('BCABBBBACB')) {'BC': 256, 'CA': 257, 'AB': 258, 'BB': 259, 'BBB': 260, 'BA': 261, 'AC': 262, 'CB': 263} [66, 67, 65, 66, 259, 66, 65, 67, 66] >>> print(compress('CABCCCCBAC')) {'CA': 256, 'AB': 257, 'BC': 258, 'CC': 259, 'CCC': 260, 'CB': 261, 'BA': 262, 'AC': 263} [67, 65, 66, 67, 259, 67, 66, 65, 67] >>> print(compress('ACBAAAABCA')) {'AC': 256, 'CB': 257, 'BA': 258, 'AA': 259, 'AAA': 260, 'AB': 261, 'BC': 262, 'CA': 263} [65, 67, 66, 65, 259, 65, 66, 67, 65] >>> print(compress('BACBBBBCAB')) {'BA': 256, 'AC': 257, 'CB': 258, 'BB': 259, 'BBB': 260, 'BC': 261, 'CA': 262, 'AB': 263} [66, 65, 67, 66, 259, 66, 67, 65, 66] >>> print(compress('CBACCCCABC')) {'CB': 256, 'BA': 257, 'AC': 258, 'CC': 259, 'CCC': 260, 'CA': 261, 'AB': 262, 'BC': 263} [67, 66, 65, 67, 259, 67, 65, 66, 67] >>>
The entries to the dictionary are gievn as key value pairs in the above snippet area. For the above cases we find that the output string contains the maximum entries and the dictionary contains the maximum entries as well.
Please feel to ask for the code whenever you like. I have not included the code as it was not asked for in the question. Plese do not forget to give a thumbs up for my work and presentation. Thanks and regards.
Problem 9 Suppose the alphabet is E= {a,b,c}. Give a string of length 10 composed for...
Problem 3 a) How many strings are there of length 10 over the alphabet (a, b) with exactly five a's? b) How many strings are there of length 10 over the alphabet (a, b, c) with exactly five a's?
Suppose the alphabet is sigma = {a, b, ..., z, 0, 1, ..., 9,: }, i.e., the standard letters a-z, decimal numbers, and colon (: ). The colon is used as a delimiter between fields in a text file. Each line of the file thus corresponds to a string. a) Give a regular expression that accepts strings with four fields (i.e., with 3 delimiters). b) Give a regular expression that accepts strings where the second field is numerical. c) Give...
Let Σ = {0, 1). (a) Give a recursive definition of Σ., the set of strings from the alphabet Σ. (b) Prove that for every n E N there are 2" strings of length n in '. (c) Give a recursive definition of I(s), the length of a string s E Σ For a bitstring s, let O(s) and I(s) be number of zeroes and ones, respectively, that occur in s. So for example if s = 01001, then 0(s)...
Additional 9-13 Prove that the language {w#w|w is a string over the alphabet {a,b,c}} is not regular Tip: here are some strings in that language: abbc#abbc a#a aaa#aaa aaab#aaab cab#cab
Give the regular expressions of the following languages (alphabet is ab): a. {w | w has a length of at least three and its second symbol is a b} b. {w | w begins with an a and ends with a b} c. {w | w contains a single b} d. {w | w contains at least three a's} e. {w | w contains the substring baba} d. {w | w is a string of even length} e. The empty...
4.[10 points] Let A be the language over the alphabet E-(a, b} defined by regular expression (ab U b)*a U b. Give an NFA that recognizes A. Draw an NFA for A here. 4.[10 points] Let A be the language over the alphabet E-(a, b} defined by regular expression (ab U b)*a U b. Give an NFA that recognizes A. Draw an NFA for A here.
Suppose that the 64-bit string A B C D E F 9 8 7 6 5 4 3 2 1 0 is obtained after the initial permutation in DES. Compute the 32-bit strings L1 and R1 knowing that the round key K1 is 0 1 2 3 4 5 6 7 8 9 A B.
1. Consider the alphabet {a,b,c}. Construct a finite automaton that accepts the language described by the following regular expression. 6* (ab U bc)(aa)* ccb* Which of the following strings are in the language: bccc, babbcaacc, cbcaaaaccbb, and bbbbaaaaccccbbb (Give reasons for why the string are or are not in the language). 2. Let G be a context free grammar in Chomsky normal form. Let w be a string produced by that grammar with W = n 1. Prove that the...
Help with Game Theory! (10) Suppose that a, b, e, d, e, f,9, and h are real numbers that are all different. For the following game, select the correct answer among the choices below. Player 2 LIR U a, b c, d It is possible that this game has exactly twO NEPS 0 It is possible that this game has exactly three NEPS It is possible that this game has exactly four NEPS It is impossible that this game has...
Write Java code to implement a FSM machine that recognizes the language for the alphabet {a,b,c} consisting of all strings that contain two consecutive c's and end with b. Your FSM program should include the following three static methods (Java) or functions (C): a. int nextState(int state, char symbol) A state-transition function that returns the next state based on the current state and an input symbol. This function should also return -1 when an invalid input character is detected. State...