Question: solve list language or list stretch you CANNOT use recursion to implement these functions. You MUST use a STACK BASED implementation. C OR C++ c
ing functions. Pay attention to the declaration. You cannot use recursion to implement these functions. You must use a stack based implementation. 1.1 The test questions There are three functions that you need to study for the test. For your test, you will be given one of these to code up. In all cases, you can assume th purely alphanumeric and that the argument k o . List allAnagrams (string input). An anagram of a string is just a permutation of the string. You must write a function that produces all anagrams of the input string in a list. The order does not matter. For example, if the input string was "abc", the function should output a list containing the following strings: abc, acb, bac, bca, cab, cba. List language(string input, int k). You will see a lot about lan- guages when you study Computational Models. Just think of the input string as a set of characters (formally called an alphabet). The language generated by S is the set of all strings comprising of characters (symbols) in S. This function generates a list of all strings in the language, whose length is at most k. Note that empty string is also part of the language. The order of the list does not matter. For example, if the input is 'abe" and k = 2, then the output list has the following strings: (the empty string), a, b, c, aa, bb, cc, ab, ac, ba, bc, ca, cb. You can assume that input does not have repeated characters. List stretch(string input, int k). A stretch of the input string is generated by repeating each character in order up to k times (and at least once). For input string "abc" and k = 2, the output list should have: abc, aabc, abbc, abec, aabbc, aabec, abbec, aabbec. (Again, the order does not matter.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
