akosiraff

Download LanguageEvaluator

Oct 8th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/languageevaluator/
  3. Use stacks to evaluate if a given string is in a language L.
  4. 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
  5. the use of counting the input string in any manner will NOT receive any credit.
  6. Let L1= { w: w contains equal numbers of A’s and B’s (in any order) and no other characters}
  7. L2 = { w: w is of the form AnBn, for some n >0 }
  8. L3 = { w: w is of the form AnB2n, for some n >0 }
  9. L4 = { w: w is of the form (AnBm)p, for some m,n,p >0 }
  10. w = AAABBB
  11. AB
  12. e
  13. ( the empty string)
  14. ABABABA
  15. ABAB
  16. BBAA
  17. BBBAA
  18. AAB
  19. AABBCCD
  20. ABCBA
  21. ABBBA
  22. ABBA
  23. ABAABBAAABBB
  24. AABACAB
  25. AA
  26. AABBBAABBB
  27. Test each string given as well as additional strings you make up yourself against each of the four
  28. languages. A non-trivial fifth 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 you choose? Why?
  29. Note: You are expected to write the stack code yourself and not use the library stack class. Be sure to include the code for your stack as part of the source code you submit.
  30. Download: http://solutionzip.com/downloads/languageevaluator/
Add Comment
Please, Sign In to add comment