Practical Problem Solving with Algorithms

Kyle Simpson

Kyle Simpson

You Don't Know JS
9 hours, 14 minutes CC
Practical Problem Solving with Algorithms

Course Description

You’ve likely taken several algorithms and data structures courses and know the “what”, and now it’s time to put the knowledge to practice! Develop better problem-solving skills by thinking through challenges and applying various algorithms and computer science techniques. Use recursion, traversals, acyclic paths, memoization, and garbage collection to optimize your solutions and think like a true algorithmist.

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

Preview
Close

Course Details

Published: April 10, 2023

Learning Paths

Learn Straight from the Experts Who Shape the Modern Web

Your Path to Senior Developer and Beyond
  • 200+ In-depth courses
  • 18 Learning Paths
  • Industry Leading Experts
  • Live Interactive Workshops
Get Unlimited Access Now

Table of Contents

Introduction

Section Duration: 20 minutes

Primer

Section Duration: 36 minutes

Example Problems

Section Duration: 22 minutes

Periodic Table Speller

Section Duration: 1 hour, 56 minutes
  • Periodic Table Speller Setup
    Kyle introduces the Periodic Table Speller project and provides instructions for cloning the project repository and running the code. In this project, a word entered in the text box will be spelled using element symbols from the periodic table. The "start-here" branch should be used to begin the project.
  • Lookup Function
    Kyle implements the lookup function, which returns an element based on a specified symbol. The toLowerCase method is used to make the lookup case-insensitive.
  • Check Function: Recursion
    Kyle begins implementing the check function. It loops through the elements in the periodic table and checks to see if any symbols match part of the submitted word. If so, the check function is recursively called on for any remaining characters in the word.
  • Check Function: Base Case
    Kyle finishes the check function by adding base cases that stop the function from being recursively called. When a base case is reached, the recursive function calls are sequentially returned off the call stack, and the array of symbols is completed. The solution can be found on the option-1 branch.
  • Optimizing the Lookup Function
    Kyle optimizes the lookup function by creating an index of symbols when the data is loaded inside the loadPeriodicTable function. This index can be used inside the lookup function, eliminating the need for a loop. The option-1 branch can be used as a starting point for this lesson.
  • Finding Candidates
    Kyle creates a findCandidates function to recursively find a list of symbol candidates matching one and two-letter character combinations in the submitted word. Note: Better code optimizations can be found on the option-2b and option-3 branches.
  • spellWord Function with Character Sets
    Kyle refactors the check function to use a spellWords function that recursively searches for matching symbols by prioritizing two-character matches. Note: Better code optimizations can be found on the option-2b and option-3 branches.
  • spellWord Function Q&A
    Kyle answers optimization questions and discusses alternate implementations. A small refactor is performed for consistency, and a bug is addressed. Note: Better code optimizations can be found on the option-2b and option-3 branches.
  • Performance Characteristics
    Kyle highlights the performance characteristics of the Periodic Table Speller and compares theoretical vs. practical performance. Note: Better code optimizations can be found on the option-2b and option-3 branches.

Chessboard Diagonals

Section Duration: 1 hour, 29 minutes

Knight's Dialer

Section Duration: 2 hours, 10 minutes

Wordy Problem

Section Duration: 2 hours, 6 minutes

Wrapping Up

Section Duration: 12 minutes

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now