This tutorial outlines a challenge that requires printing a LinkedList in reverse order.
(shimmery music)…- [Instructor] It's time for your challenge.…The objectives of this challenge…is to print a linked list in reverse order.…We did an example of printing a linked list…in regular order so that hopefully gave you an idea…so now see if you can figure out…how to either start from scratch…or use that program and re-engineer it…to print everything in reverse order,…so you're going to use recursion to print the list.…The base case is when there are no more nodes in the list,…and you're going to remove the first element,…and hold onto that element,…then print the rest of the list in reverse order…until you get to the base case…where there's no more, then you print the first element.…
Okay, I'm going to estimate that this challenge…is going to take you about 10 minutes.…If especially if you use the example that we had earlier,…but go ahead and give it a try.…When you're done, come back and check out my solution movie…to see how I solve the problem…as I explain my thought process along the way.…
Programmers involved in mathematical computations, such as mathematical induction, are probably the biggest users of recursion. You probably know some of the most common recursive problems; finding the factorial of a number and the Fibonacci series are both examples of recursive processes. In this course, staff instructor and Java expert Peggy Fisher explores programming solutions involving both of these problems. She reviews the concept of recursion, discusses approaches to solving problems using recursion, and examines some recursive examples.
- Defining recursion
- Reviewing recursive examples
- Converting decimal to binary
- Printing a LinkedList
- Writing a power function