FrontendMasters – Data Structures and Algorithms in JavaScript

0 255

FrontendMasters – Data Structures and Algorithms in JavaScript Download

Immerse yourself in a course tailored for engineers comfortable with JavaScript, but wanting to better understand the data structures and algorithms necessary to ace job interviews and build better software.

FrontendMasters - Data Structures and Algorithms in JavaScript Download
FrontendMasters – Data Structures and Algorithms in JavaScript Download

Learn topics like recursion, stacks & queues, sorting algorithms, trees, linked lists, Binary Search Trees, Graphs, & Hash Tables, Big-O and Breadth-First and Depth-First Search all in one place! This course is your key to understanding some of the most common data structures and algorithms in Computer Science while reinforcing JavaScript programming techniques. Master these concepts and you can approach your next job interview or coding challenge with confidence!

This course and others like it are available as part of our Frontend Masters video subscription.

Table of Contents

Object Oriented JavaScript

  • Introduction
    Bianca Gandolfo begins her Data Structures & Algorithms course by sharing her background and how she developed this course. She will be using a cooking metaphor throughout the course because she believes learning these concepts involves understanding the “recipes”, watching them in action, and getting time to try them out yourself.
  • Agenda and Scope
    Bianca quickly walks through the agenda and scope of this six-day course. The fundamentals introduced and practiced in the first day will be used throughout the rest of the course. This course is based on university-level computer science courses and covers the most common data structures and algorithms programmers use today.
  • How to Succeed
    Using a “fad diet” metaphor, Bianca explains what it takes to succeed in this course. She recommends pairing up with someone or a team of people to try the exercises and discuss the solutions. Ask questions and don’t be afraid of failure.
  • Pseudoclassical JavaScript
    JavaScript is often referred to as “pseudoclassical” because it’s an object-oriented language but lacks a formal way of creating class constructors. While this changes in ES6, Bianca introduces this concept of pseudoclassical JavaScript and leads a discussion about why data needs structure.
  • Defining a Class
    Bianca presents her recipe for defining a class in JavaScript. She describes the constructor and properties as an object’s “what it is” and “what it has”. Methods on the object are “what it does”.
  • Using a Class
    Before moving into the first exercise, Bianca shares a few examples of how classes are used in JavaScript. She also talks about what parts of pseudoclassical JavaScript are typically required knowledge in job interviews.
  • Exercise: Creating a Constructor
    In this exercise, you will create a unique constructor that creates a building of your choice. Your constructor will use the pseudoclassical JavaScript pattern.
  • Creating a Constructor Solution
    Bianca walks through the solution to the Creating a Constructor exercise.

Stacks & Queues

  • Stacks
    The first data structure Bianca introduces is a stack. With each data structure, she will be drawing it out, pseudocoding it, then putting it to work with an API and any applicable algorithms. The stacks API follows a last-in-first-out model where the last item added to the stack is the first item removed.
  • Stacks Interface
    The interface for a stack contains a constructor function for handling the storage along with push(), pop(), and size() methods for manipulating the stack. After introducing the interface, Bianca share an example of the methods defined in JavaScript.
  • Implementing a Stack
    Bianca implements each method of the Stack object. The constructor initializes the storage object. In this case, she’s using a String for storing the stack data. She then implements the push() and pop() methods which add and remove items from the stack.
  • Queues
    Queues are similar to a stack except for the order in which items are added. In the case of a queue, the first item in is the first item out. Rather than push() and pop() methods, a queue has an enqueue() method for adding items and a dequeue() method for removing items.
  • Exercise: Creating Stacks and Queues
    In this exercise, you will implement both the Stack and Queue data structures. Each data structure is stubbed out and commented with the instructions for what you need to complete. –,
  • Creating Stacks and Queues Solution
    Bianca walks through the solution to the Creating Stacks and Queues exercise. he code for the solution is located on the “solutions” branch in the Github exercise repository. –


  • Why Recursion?
    Recursion occurs when a function calls itself. Bianca makes a case for recursion and talks about why understanding the core concepts will make it easier to understand other use cases like recursive algorithms or recursive data structures.
  • Tracing Recursive Execution
    Bianca explores a recursive function by tracing through each call. The callMe() function continues to call itself until the tracker variable satisfies the base case. If the function’s base case is never reached, an infinite loop may occur.
  • Template for a Recursive Function
    Bianca summarizes her recursion introduction by sharing the recipe for a recursive function. You identify the base case, identify the recursive case, return when appropriate, and write procedures that bring you closer to the base case.
  • Looping
    In JavaScript, loops can be created with statements like for() and while(). A loop can also be created with a recursive function. Bianca walks through an example of loop implementing through the use of recursion.
  • Factorial with Loop
    Using factorials as an example, Bianca first looks at how the factorial algorithm would be implemented with a for() loop. The loop starts at the number 2 and continues to multiply the numbers together until the desired factorial is reached. She will use this example as a baseline for implementing the recursive example.
  • Factorial with Recursion
    Bianca now looks at the implementation of the factorial algorithm with recursion. The recursive computeFactorial(num) function continues to call itself while decrementing the num parameter. Once num is equal to one, the function returns and the results of all the calls on the stack are multiplied together.
  • Exercise: Recursion Interview Questions
    In this exercise, you will implement a common recursion questions that are often asked during job interviews. –
  • Recursive Reverse Solution
    Bianca begins walking through the solution to the Recursion Interview Questions exercise. The first question she answers is how to implement a recursiveReverse() function.
  • Recursive Multiplier Solution
    Bianca continues her demonstration of the solution to the Recursion Interview Questions exercise by implementing the recursiveMultiplier() function.
  • Implementing a Queue with Two Stacks Solution
    Bianca continues working through the exercises left over from the Stacks & Queues topic. In this video, she looks at the solution to implementing a queue by using two stacks.



FrontendMasters – Data Structures and Algorithms in JavaScript Download


If This Post is Helpful to You Leave a Comment Down Below Also Share This Post on Social Media by Clicking The Button Below

You might also like

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. AcceptRead More