PART 2 / LESSON 14 · Overview free · interactive lesson in the full course

Recursion, backtracking and stack cost

Reason about recursive search, termination, pruning and stack consumption in constrained programs.

View lesson accessAll lessons

What the lesson covers

The course lesson is called The menu that explores itself. The configuration menu is written as a function that calls itself for each sub-menu. It works on the bench, then a deeper menu overflows the stack in the field.

Before you start

Question to think about: How can maximum recursion depth be bounded for the intended inputs?

Preparation exercise: Draw a small search tree and identify termination conditions, state restoration and a memory budget.

This is an original public study prompt, not the paid lesson or its solution. The interactive course contains the walkthroughs, labs, exercises and recaps.

Read the free embedded C articles for additional practice.

Test your understanding

Practice free firmware interview questions and mock interviews · Assess your readiness