Assign3: Recursion


Due Friday, May 01 at 11:59 pm


This week's assignment is a recursion "sampler", focusing on implementing a number of small, isolated recursive functions. Learning to solve problems recursively can be challenging, especially at first. We think it's best to practice in isolation before adding the complexity of integrating recursion into a larger program. We'll get to that in future assignments!

The recursive solutions you need to write are quite short; just a handful of lines each. However, this doesn't mean you should put the assignment off until the last minute! It may only take a few concise, elegant lines, but recursive code can be dense and complex and requires your full attention to get the details just right.

Recursive problem-solving also can take a bit of time to get used to. We recommend that you start on the problem set early in the week, so as to allow yourself enough time to wrap your head around this new way of solving problems.

Dedicate yourself to deeply assimilating the foundation concepts within the context of these small, targeted problems. Lecture will continue on to explore more advanced applications of recursion. By next week, you'll be in prime shape to tackle recursive solutions for even more impressive problems.

Learning goals

Assignment parts

This assignment consists of a short warmup exercise and four recursive functions.

Getting started

We provide a ZIP of the starter project. Download the zip, extract the files, and open the project in Qt creator.

šŸ“¦ Starter code

The source files you will edit are warmup.cpp, balanced.cpp, combos.cpp, fractal.cpp, and predict.cpp.

Additionally, you will answer questions in short_answer.txt.

This assignment is to be completed individually. Working in pairs/groups is not permitted.

Getting help

Here are some resources that you might find helpful while working on this assignment:

Submit

Review our submission checklist before calling it done. Upload your completed files for grading to the Paperless website.

Please submit only the files you edited; for this assignment, these files will be

šŸ Submit to Paperless

Note: When submitting to Paperless, due dates are expressed in PDT.