## ThePrimeagen

terminal

Welcome to a super fun, beginner-friendly data structures and algorithms course. Is it really the last algorithms course you'll need? If you want to pass tough interview questions, then yes! You'll learn big o time complexity, fundamental data structures like arrays, lists, trees, graphs, and maps, and searching and sorting algorithms.

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

Preview

ClosePublished: September 12, 2022

Your Path to Senior Developer and Beyond

- 200+ In-depth courses
- 18 Learning Paths
- Industry Leading Experts
- Live Interactive Workshops

Section Duration: 7 minutes

- ThePrimeagen introduces the course by discussing some personal background with algorithms, types of algorithms that will be covered, and suggestions for retaining the information presented in this course. Reasons to learn algorithms, why this course uses TypeScript, and ThePrimeagen's social media links are also provided in this lesson.

Section Duration: 29 minutes

- ThePrimeagen discusses an overview of Big O, including, what it is, why it's used, and some essential concepts. A walkthrough of a Big O code example is also provided in this segment.
- ThePrimeagen demonstrates interpreting arrays as a fixed size, contiguous memory chunk by walking through array positions in an array buffer. Operations that can be performed on an array are also demonstrated in this segment.
- ThePrimeagen answers student questions about whether there is no insert, push, or pop in an array and if an array's size and memory allocation must be specified at initialization. Questions regarding whether something that has an array is being created when creating an array in JavaScript and how big the array is that is instantiated are also covered in this segment.

Section Duration: 39 minutes

- ThePrimeagen discusses searching through an array with a linear search algorithm. Setting up the TypeScript library Kata and a walkthrough of implementing the linear search algorithm are also covered in this segment.
- ThePrimeagen demonstrates a search algorithm that jumps forward by ten percent, discusses possible pitfalls of that search, and demonstrates how the binary search algorithm differs. Binary search is an efficient algorithm for finding an item from a sorted list of items.
- ThePrimeagen walks through creating and implementing a pseudo-code version of a Binary search algorithm.
- ThePrimeagen demonstrates implementing the binary search algorithm in TypeScript and uses the kata machine to test that the algorithm is correct. The binary search algorithm repeatedly halves the portion of a sorted list that could contain the target item until the possible locations have been narrowed down to one.
- ThePrimeagen discusses options for solving this previous interview problem: When given two crystal balls that will break if dropped from a high enough distance, determine the exact spot in which it will break in the most optimized way. This segment demonstrates breaking down a search problem without using a linear search.
- ThePrimeagen walks through implementing the solution for the two crystal balls problem. Student questions regarding traveling using the cube root of N are also covered in this segment.

Section Duration: 1 hour, 6 minutes

- ThePrimeagen demonstrates what happens under the hood when bubble sorting. Bubble sort repeatedly steps through the input list, swapping their values if needed until no swaps have to be performed during a pass, meaning that the list has become fully sorted.
- ThePrimeagen walks through implementing and testing the bubble sort algorithm. Student questions regarding how the formula was produced and for sorting algorithm suggestions for immutable arrays are also covered in this segment.
- ThePrimeagen discusses an overview of linked list data structures, including implementing deletion and insertion. A student's question regarding if there is no index in the linked list is also covered in this segment.
- ThePrimeagen discusses the time and space complexity of linked lists. A student's question regarding the insertion of F is also covered in this segment.
- ThePrimeagen discusses the function of a queue, a linear data structure that follows the First in, First Out Principle (FIFO). Queue supports operations such as peek, enqueue, dequeue and print().
- ThePrimeagen walks through implementing and testing the queue algorithm.
- ThePrimeagen answers student questions regarding if having no tail means there is no node, clarification on the peek method, and why this.tail.next is being set to the new node.
- ThePrimeagen demonstrates a linear data structure that follows the principle of Last In First Out, the opposite of a queue, a stack. In a stack, the last element inserted inside the stack is removed first.
- ThePrimeagen walks through implementing and testing a stack, including push, pop, and peek.

Section Duration: 39 minutes

- ThePrimeagen discusses similarities and differences between arrays and linked lists. Linked lists use less memory, but must be stepped through to find the target item. A demonstration of traversing a linked list is also provided in this segment.
- ThePrimeagen demonstrates the ability to write list operations such as get, push, and pop on arrays using ArrayList.
- ThePrimeagen discusses an ArrayBuffer object which is used to represent a generic, fixed-length raw binary data buffer.
- ThePrimegen walks through an empirical test for what data structure is being used under the hood with `const a = []`. Student questions regarding if unshift and shift are exponential, what type of operation is slice, and where would this be used in practical code are also covered in this segment.

Section Duration: 47 minutes

- ThePrimeagen discusses recursion as a function that calls itself until it reaches the base case and the problem is solved. Recursion can be broken into three steps: pre, recurse, and post.
- ThePrimeagen walks through an example of pathfinding using a base case by implementing and testing the MazeSolver example in the kata machine.
- ThePrimeagen walks through the MazeSolver example of pathfinding using the recursive case.
- ThePrimeagen answers student questions regarding what happens when the recursive function can no longer move forward, how the end path of the MazeSolver was found, and if there are any scenarios in which changing the recursion direction would improve performance.

Section Duration: 29 minutes

- ThePrimeagen discusses the QuickSort algorithm as an algorithm that uses a divide and conquer technique. The algorithm picks a pivot element and rearranges the array so elements smaller than the pivot element move to the left side of the pivot, and elements greater move to the right side. The algorithm then recursively sorts the subarrays on the left and right of the pivot element.
- ThePrimeagen walks through implementing and testing the QuickSort algorithm in the kata machine. Both a Quicksort function and a partition function are implemented in this segment.

Section Duration: 35 minutes

- ThePrimeagen walks through implementing a doubly linked list, including prepend, insertAt, and append.
- ThePrimeagen walks through implementing the second half of a doubly linked list, including remove, get, and removeAt.
- ThePrimeagen answers student questions regarding using VIM, if setting remove undefined would break, where the methods are taken from, and the reason for using the Java methods.
- ThePrimeagen walks through debugging the remove portion of the doubly linked list. A student's question regarding an example of keeping track of removed nodes is also covered in this segment.

Section Duration: 32 minutes

- ThePrimeagen discusses an overview of more advanced data structures known as trees and walks through some terminology with a whiteboard example. A tree can be empty with no nodes, or a tree can be a structure consisting of one node called the root and zero or one or more subtrees.
- ThePrimeagen discusses and demonstrates, via whiteboarding, visiting nodes using three types of traversals preorder, inorder, and postorder.
- ThePrimeagen live codes the three types of tree traversals. Inorder traversal traverses one subtree of a node, visits the node, and then traverses its other subtree. Preorder traversal visits a node and then traverses both of its subtrees. Postorder traversal traverses both subtrees of a node, then visits the node.

Section Duration: 1 hour

- ThePrimeagen discusses using a queue data structure to perform a breadth-first search and the running time.
- ThePrimeagen walks through implementing a breadth-first search on a binary tree by pushing into a queue instead of recursing. A brief discussion regarding student preferences between breadth-first and depth-first searches is also covered in this segment.
- ThePrimeagen walks through an interview question example of comparing the contents and shape. Depth-first search preserves tree shape, while breadth-first search does not.
- ThePrimeagen walks through implementing breadth-first and depth-first searching to compare two binary trees and testing the resulting functions using the kata machine.
- ThePrimeagen discusses quick finding using a binary search tree. Students' questions regarding possible use cases and if the right side can be greater than the initial node or if it has to be equal are also covered in this segment.
- ThePrimeagen writes out pseudo-code to demonstrate insertion in a binary tree and demonstrates what to do in a null case.
- ThePrimeagen discusses deletion cases in a depth-first binary tree, including, no child and one child while smallest on the large side and largest on the small side can be reduced to no child and one child deletion.
- ThePrimeagen answers student questions regarding if the tree will be balanced after insertion, AVL compared to red black, if removing the same node can result in different trees, and if there are other ways to make trees.
- ThePrimeagen walks through implementing and testing a depth-first binary search.

Section Duration: 49 minutes

- ThePrimeagen discusses the heap data structure as a binary tree where every child and grandchild is smaller (MinHeap) or larger than (MaxHeap) the current node. Student questions regarding if this is considered a doubly linked list and if this is implemented in an array are also covered in this segment.
- ThePrimeagen walks through implementing and testing a MinHeap data structure using a JavaScript array in the kata machine. The insert and delete methods are implemented in this segment.
- ThePrimeagen discusses visualizing tries as autocomplete, demonstrates the structure of a trie tree with pseudo code, and implements a trie tree in the kata machine. Insertion and deletion in a trie tree are also covered in this segment.

Section Duration: 1 hour, 14 minutes

- ThePrimeagen discusses an overview of graphs as a series of nodes with connections and terminology related to graphs. Vocabulary covered in this segment includes cycle, acyclic, connected, directed, undirected, weighted, dag, node, and edge.
- ThePrimeagen demonstrates representing graphs in an adjacency matrix. Breadth-first and depth-first searches still exist on a graph, and are virtually the same as on a tree.
- ThePrimeagen walks through implementing and testing a breadth-first search on an adjacency matrix using the kata machine. An adjacency Matrix is a 2D array of size V x V where V is the number of vertices in a graph.
- ThePrimeagen walks through implementing and testing a depth-first search on an adjacency list using the kata machine. An Adjacency list is an array consisting of the address of all the linked lists.
- ThePrimeagen discusses Dijkstra's shortest path, what it is, where it's used, and demonstrates some variations of it. Dijkstra's shortest path is an algorithm that finds the shortest paths between nodes in a graph.
- ThePrimeagen walks through implementing and testing a version of Dijkstra's shortest path in the kata machine.
- ThePrimeagen discusses the running time of Dijkstra's shortest path by walking through what happens behind the scenes in pseudo-code. A student's question regarding if there are a lot of graph questions in interviews is also covered in this segment.

Section Duration: 44 minutes

- ThePrimeagen discusses an overview of map terminology, including load factor, key-value, and collision.
- ThePrimeagen discusses a least recently used cache data structure that evicts the least recently used item. An LRU cache is a combination of map and linked list data structures.
- ThePrimeagen walks through setting up a pseudocode outline for the LRU cache data structure.
- ThePrimeagen walks through implementing and testing an LRU cache in the kata machine.

Section Duration: 3 minutes

- ThePrimeagen wraps up the course by providing a brief overview of the material covered and directions on what to look into next. Heartfelt well wishes and encouragement to utilize opportunities given are also provided in this segment.

Really enjoying ThePrimeagen's Frontend Masters course on Algorithms. I hate grinding LeetCode/algo stuff but it has been a pleasure to watch and the jokes crack me up.

Sk Imtiaz Ahmed

imtiaz101325

ThePrimeagen's Algorithm course on Frontend Masters is the best online course I've ever taken, and the ending was pretty inspiring.

_drewcodes

_drewcodes

- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops