# A Practical Guide to Algorithms with JavaScript

Topics:

Table of Contents

## Introduction

## Space & Time Complexity

### Introducing Space & Time Complexity

Bianca introduces the concept of time complexity, space complexity, and understanding algorithmic speed. Bianca answers questions from students.### Native Methods & JavaScript

Time complexity of Native JavaScript methods and expressions such as property access, loops, and native array methods. Bianca answers questions from students about various methods such as map, reduce, and sort.### Big O Notation

Bianca reviews the different big O notations: constant, linear, quadratic, logarithmic, and exponential.### Space Complexity & Review

After discussing space complexity, Bianca reviews Big O notations and time complexity.### Big O: Loop

Bianca dissects function with a loop to reason about the time complexity.### Big O: Property Lookup

Bianca walks through a property lookup in an array.length and measures time complexity.### Big O: Push, Shift, & Unshift

Bianca contrasts different array methods and their respective time complexity.

## Optimization with Caching

### Faster Algorithms

Bianca reviews two common ways to speed up algorithms through caching previous values significantly.### Unique Sort Exercise

In this exercise, students Implement unique sort, which removes duplicates from an array.### Unique Sort Solution

Bianca reviews the breadcrumbs caching technique while walking through the unique sort solution.### Caching with Memoization

Bianca discusses the difference between memoizing and the breadcrumbs caching technique.### Basic Memoization Exercise

In this exercise, students use a global cache to memoize.### Basic Memoization Solution

Bianca walks through the Basic Memoization Exercise and answers questions from students.### Memoization with Closure Exercise

In this exercise, students improve the memoize function by moving the cache into a closure.### Memoization with Closure Solution

Bianca walks through the Memoization with Closure Exercise to show how to use a closure to make the cache local. Bianca answers questions from students.### Generic Memoize Function Exercise

In this exercise, students make a memoize function generic by passing in the function rather than hardcoding a function.### Generic Memoize Function Solution

Bianca reviews the previous two exercises and walks through how to transform the hardcoded memoize function into a generic memoize function.### Reviewing Optimization

Bianca wraps up discussing the different caching techniques by reviewing the trade-off between time complexity and space complexity.

## Recursion

### Introducing Recursion

Bianca introduces recursion, which is when a function calls itself, and its importance in programming.### Call Stack Walkthrough

Bianca demonstrates recursion through the Call Stack Game, which shows how JavaScript executes functions with the call stack. Bianca answers questions from students.### Looping with Recursion

Bianca walks through an example of loop implementing through the use of recursion.### Factorial with a Loop

Bianca 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.### Looping Review

Bianca reviews the differences and benefit of recursion and a loop.### Wrapper Functions

Bianca introduces wrapper functions as a pattern for recursion.### Accumulators

Bianca walks through the accumulator technique, which gathers all callbacks returned values.### Iterative Loop Exercise

In this exercise, students translate a recursive pattern into an iterative loop.### Iterative Loop Solution

Bianca walks through the solution to Iterative Loop Exercise.### Recursive Factorial & Memoize Exercise

In this exercise, students write their own recursive factorial method.### Recursive Factorial & Memoize Solution

Bianca walks through the solution to Recursive Factorial & Memoize Exercise.

## Divide & Conquer

### Introducing Divide & Conquer

Bianca introduces what divide and conquer method to sorting. After data is separated into smaller lists, the merge step combines two sorted lists into one sorted list.### Linear Search Exercise

In this exercise, students implement linear search.### Linear Search Solution

Bianca walks through the solution to Linear Search Exercise. Bianca answers questions from students.### Binary Search

Bianca illustrates binary search, which allows a search of a sorted array by repeatedly splitting the array in half. Binary search is fast Since with each iteration half of the array is determined to be undesired, instead of just one wrong value.### Divide & Conquer Review

Bianca reviews divide and conquer.### Sorting Types

Bianca discusses the two main types of sorting: naive and divide & conquer. Bianca answers questions from students.### Merge Sort

Bianca reviews merge sort, which is an algorithm that takes a "divide and conquer" approach to sorting. With merge sort, data is separated into smaller lists, the merge step combines two sorted lists into one sorted list.### Merge Sort Walkthrough

Bianca walks through a code example of merge sort.### Bubble Sort & Merge Sort Exercise

In this exercise, students implement bubble sort and merge sort.### Bubble Sort Solution

Bianca walks through the first part of the Bubble Sort & Merge Sort Exercise by coding the solution to bubble sort.### Merge Sort Solution

Bianca walks through the last part of the Bubble Sort & Merge Sort Exercise by coding the solution to mergesort. Bianca answers questions from students.

## Greedy Algorithms

### Introducing Greedy

Bianca introduces the greedy algorithm, which is an algorithmic paradigm that follows the problem-solving course of making the locally optimal choice.### Greedy Algorithms Walkthrough

Bianca walks through a "make change" problem to demonstrate the greedy algorithm.### Brute Force

Bianca reviews the brute force approach, which calculates every single combination possible and keeps track of the minimum. Bianca answers questions from students.

## Dynamic Algorithms

### Introducing Dynamic Programming

Bianca discusses dynamic programming, which is a data optimization technique. The dynamic approach caches values to avoid repeated calculations. Bianca answers questions from students.### Memoization with Recursion

Binca reviews memoization and recursive approach to the "make change" problem.### The Landscape of Data Structures & Algorithms

Bianca wraps up "A Practical Guide to Algorithms" course by reviewing the landscape of data structures and algorithms. Bianca answers questions from students.