Question: Please write code in C++ or C, details would be really helpful. If can, please give output screenshot. 1 Setting You already have recursive and


Please write code in C++ or C, details would be really helpful. If can, please give output screenshot.
1 Setting You already have recursive and stack-based code that prints all subsequences of an input string The I/O format has been fixed. The input and output files are given as command line arguments. The first line of the input file is read into a string. This is processed by a function to produce a list of strings as output. This list is sorted and then printed to a file. This is exactly the setting you will see in your test. For the stack section test, you will have to implement one of the follow- ing functions. Pay attention to the declaration. You cannot use recursion to implement these functions. You must use a stack based implementation. 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 is the set of all strings comprising of characters (symbols) in E. 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 "abc" 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. 1 Setting You already have recursive and stack-based code that prints all subsequences of an input string The I/O format has been fixed. The input and output files are given as command line arguments. The first line of the input file is read into a string. This is processed by a function to produce a list of strings as output. This list is sorted and then printed to a file. This is exactly the setting you will see in your test. For the stack section test, you will have to implement one of the follow- ing functions. Pay attention to the declaration. You cannot use recursion to implement these functions. You must use a stack based implementation. 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 is the set of all strings comprising of characters (symbols) in E. 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 "abc" 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
