subject

Use stacks to evaluate if a given string is in a language L. Your code will not be recursive. In your analysis, suggest a recursive algorithm and compare with your stack based solution. The purpose of using a stack is to take advantage of its LIFO nature, therefore algorithms which merely use the stack for storage and determine inclusion of the string in the language by the use of countingthe input string in any manner will NOT receive any credit. Let L1= { w: w contains equal numbers of A's and B's (in any order) and no other characters}L2 = { w: w is of the form AnBn, for some n > 0 }L3 = { w: w is of the form AnB2n, for some n > 0 }L4 = { w: w is of the form (AnBm)p, for some m, n,p > 0 }L5 = { a non-trivial language of your choice}Examples of languages which are only trivially different from L1 and L2:L5 = { w: w contains equal numbers of C's and D's (in any order) and no other characters},L5 = { w: w is of the form CnDn for some n > 0 },L5 = { w: w is of the form BnAn for some n > 0 }.w = AAABBBAB? ( the empty string) each string given as well as additional strings you make up yourself against each of the fivelanguages. A sixth language would be considered an enhancement. Be sure to discuss your data structures and their implementation and why they make sense. E. g.why is stack a reasonable choice to solve this problem? What implementation of a stack did youchoose? Why? As stated above, consider a recursive solution and compare it to your iterativesolution. Is one better than the other? If so, why?

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Which best describes the role or restriction enzymes in the analysis of edna a. to break dna into fragments that vary in size so they can be sorted and analyzed b. to amplify small amounts of dna and generate large amounts of dna for analysis c. to purify samples of dna obtained from the environment so they can be analyzed d. to sort different sizes of dna fragments into a banding pattern that can be analyzed
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
Ais a picture icon that is a direct link to a file or folder
Answers: 1
You know the right answer?
Use stacks to evaluate if a given string is in a language L. Your code will not be recursive. In you...
Questions
question
English, 25.01.2022 14:00
question
Arts, 25.01.2022 14:00
question
Mathematics, 25.01.2022 14:00
question
Mathematics, 25.01.2022 14:00
Questions on the website: 13722362