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, 22.06.2019 06:30
Exchanging which type of data uses the least bandwidth? music photographs video voice bandwidth- the amount of data that can be moved between two points in a set time period
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
What is the most popular genre of video games?
Answers: 1
question
Computers and Technology, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
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