Practice: Recursion II
đź’ˇ This is your chance to put what you've learned into action.
Try solving these practice challenges to check that you understand the concepts. No submission is necessary for practice exercises.
Why practice?
Practice coding helps you become a great coder. These practice problems aren't graded, but that doesn't mean they aren't important.
You should aim to practice a lot, especially with unfamiliar concepts. Spread practice over multiple days to take advantage of the spacing effect, which helps you retain new knowledge.
More about practice
Practice helps you understand what you know, and what you don't know. It can be easy to trick yourself into thinking you understand something when you do not -- or that you don't understand when you do. Practicing by writing code or debugging code will help you find out what you really understand, and where you are still confused.
Practice helps build confidence in your coding. The more programs you write, and the more problems you solve, the more you learn that you are a capable coder and problem-solver.
Practice doesn't always feel good - sometimes you'll be stumped! But, practice shouldn't feel super frustrating either. If you find yourself getting angry at yourself or the code, it's a good time to take a break and ask for help.
The solutions to each challenge are available, and you can view a video of the solution below each challenge.
- Try to go through the whole challenge without using the solution.
- If you can’t do the challenge without looking the solution, it means you don’t understand the material well enough yet.
- Try the next practice challenges without looking at the solution. If you need more practice challenges, reach out on Discord.
1. Sorting a list using merge sort
Consider the following list:
[19, 81, 67, 21, 42, 6, 30, 16]
- Sort the list using merge sort. Show the contents of the list as the list is split and then merged together.
- What's the state of the list after the fourth merge?
Solution video.
2. Recursive string functions
▶️ Access the practice exercise on GitHub Classroom
Watch the video below to see the full solution.
Make sure you give yourself enough time to solve the practice without watching the video. It is really important for your learning.
Solution Video
3. Recursion list functions
▶️ Access the practice exercise on GitHub Classroom
Watch the video below to see the full solution.
Make sure you give yourself enough time to solve the practice without watching the video. It is really important for your learning.