Video is locked.

Unlock this course with a free trial

Join today to access over 15,000 courses taught by industry experts.

Introduction to Data Structures & Algorithms in Java

Understanding recursion

From the course: Introduction to Data Structures & Algorithms in Java

  • Course details

    Enhance your programming skill set by learning about some of the most commonly-used data structures and algorithms. In this course, instructor Raghavendra Dixit walks through how to use Java to write code to implement data structures and algorithms. After explaining why it's advantageous to study these topics, he goes over the analysis of algorithms and discusses arrays—a data structure found in most programming languages. He also explains how to implement linked lists in Java, and covers stacks, queues, recursion, binary search trees, heaps, and more.

    Note: This course was created by Packt Publishing. We are pleased to host this training in our library.


    • Click here to view Raghavendra Dixit’s instructor page

      Raghavendra Dixit

      • Raghavendra Dixit is an entrepreneur and technical architect with over 15 years of programming experience.

        A graduate of the Indian Institute of Technology, Raghavendra has worked in both product and service-based software companies. He has worked with languages such as Perl, Java, Objective-C, Scala, and JavaScript. He has also used various frameworks and platforms, including Spring, Play, Cocoa, and Android. In his free time, he likes to create technical content that's easy to follow, and helps people in the software industry enhance their skills and accelerate their careers.

    Skills covered in this course

  • Introduction

    - [Instructor] Now let's try to understand how recursion works, and why would we get that stack overflow error in case you forgot the breaking condition, or if the depth of recursion is big. So let's use the factorial program to understand this. Now as you may know that a program's runtime usually creates a stack, which is called a method stack or a call stack, using which it keeps track of local variables or expression, evaluation etcetera. Now this call stacked in context of recursive methods is also called as recursion stack. It's one and the same thing, just a different name. Now let's say that the factorial method is called with the parameter five. Inside the factorial method, it checks if the parameter is zero, and it is not. So this method returns five into factorial of four. But factorial four itself is a method call, whose value is not yet known. So this expression five into factorial four, is stored in what is called as a stack frame and pushed into the recursion stack. And…

  • Practice while you learn with exercise files

    Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.

    Download the exercise files for this course. Get started with a free trial today.

  • Download courses and learn on the go

    Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.

    Watch this course anytime, anywhere. Get started with a free trial today.