Data structures such as Stacks, Queues, and Binary Trees, are often implemented using the concept of linked lists, which easily conforms to recursive functions. Learn how to leverage a LinkedList in this tutorial.
- [Instructor] Recursion is often used…when dealing with Linked List.…We're going to look at an example…on how to print a Linked List using Recursion.…Many data structures such as Stacks, Queues, or Binary trees…are often implemented using the concept of Linked List.…A Linked List easily conforms to a recursive function.…It uses a null reference as the base case…meaning that the Linked List is empty…and then the not next instance…refers to any Linked List that is not empty.…
And that would be the recursive call.…Here's a visual of what a Linked List might look like…that had three nodes.…It starts out with a head node…which is a pointer to the very beginning…of your Linked List.…The Node One points to Node Two,…Node Two points to Node Three,…and then the very last element points to nulled…indicate that the Linked List is done.…Let's switch over to NetBeans…and take a look at how to print a Linked List.…As you can see here, I already created…a node class.…
You will need to copy this file…and the main program file from the exercise…
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