Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you are going to write code that solves problems using recursion. Note the emphasist-you must use recursion! If you're having problems starting

image text in transcribed
image text in transcribed
image text in transcribed
For this assignment you are going to write code that solves problems using recursion. Note the emphasist-you must use recursion! If you're having problems starting a question, consider the simplest possible case (ie, a ' 1 ' or a single-character string, etc) and using induction, figure out how to get to the next case. All questions in this assignment will be answered in the same Python file: atuiqu.py, Read the description of each question below, and refor to the avsimn.py file comments for further clarification. Pay close attention to the specifications and the submission requirements. In the assugnz.py file, you will modify the recursive function called permutations (), which is given on slide 17 of Topic 2 class notes (refer to that slide for further explanation). The current code outputs the permutations as in the first version on stide 18 . You must modify the code so that the output is in a more 'systematic' ordering, as in the second version on stide 18 . 2. Generating Strings [40%) In the atsiena.yy file. implement the recursive function called generateReyerseDrder (). which generates all lengthen strings of o's and 1 's, for a given noa-negative integer n, in order from largest to smallest (aka, descending order). Your function must have n as the only parameter and must return a list containing all length-n strings of o's and 1 's (in the correct order). Fun the code to get an idea of what the expected output should look like. Note: The test output examples are in descending order, since if you consider them as binary numbers, they start at 2fi-1 and decrement each time. 3. Analyzing a String [40\%] In the atuipe. wile. implement the recursive function called cotunt Chars (), vich analyzes the given string and returnis a 3 -element list of integers representing the number of consonantw. vowals, and other characters (respectively) in that string. Your function must have a string s as the first parameter? you may add other paramaters as naceisary. Sample output should be as follows! Submission Information Subionit the nuige by fle which contains the solutions (and fester code) for all three questions above. Make sure vou do not touch the parta of coce in the fie where you are told not to do any modificatora. you will recerive oss on the question if you do se. Do not aubmit any other files or documentatient they will not be used or assessed, After submission, check that all your files are present and correct! The p2U/Erightipace Drepbou har been set up to allow you to submit updates to your asmignment multigle times until tha due date/time. Question 1 Returns all permutations of a set * Modify this to generate the set as on slide 18 of Topic 2 def permutations (aSet) : if len (aset)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

In a mortar, the binding material is cement sand surkhi cinder.

Answered: 1 week ago

Question

Determine the amplitude and period of each function.

Answered: 1 week ago