Mergesort is a well-known and efficient sorting algorithm that follows the divide-and-conquer paradigm. It aims to sort a given array or list of elements by dividing it into smaller subarrays, sorting those subarrays recursively, and then merging them back together to obtain...
Mergesort is a well-known and efficient sorting algorithm that follows the divide-and-conquer paradigm. It aims to sort a given array or list of elements by dividing it into smaller subarrays, sorting those subarrays recursively, and then merging them back together to obtain the final sorted result.
The algorithm begins by repeatedly dividing the input array into two halves until each subarray contains only one element or is empty. This process is known as the "divide" step. Then, it merges adjacent pairs of these subarrays, comparing and rearranging the elements in a sorted order. This merging process continues until a single sorted array is obtained, hence the term "merge" in mergesort.
One of the key advantages of mergesort is its stability, meaning that elements with equal values retain their original relative order after sorting. This property makes mergesort particularly useful in scenarios where preserving the original order of equal elements is crucial.
Mergesort exhibits a time complexity of O(n log n), where "n" represents the number of elements in the input array. This efficiency makes mergesort suitable for sorting large datasets, and it is often used as a standard benchmark for other sorting algorithms.
Overall, mergesort's simplicity, stability, and efficient performance have made it a popular choice in various applications, ranging from general-purpose sorting to applications in data analysis, parallel computing, and more.
0:00 Mergesort overview
2:15 Algorithm animation
3:35 The divide phase
5:10 The conquer phase
5:53 Mergesort pseudocode
7:46 Merge function
Source code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Divide and Conquer is a powerful algorithmic paradigm that breaks down complex problems into smaller, more manageable subproblems. By conquering each subproblem individually and then merging the solutions, this technique allows us to solve intricate challenges efficiently. It...
Divide and Conquer is a powerful algorithmic paradigm that breaks down complex problems into smaller, more manageable subproblems. By conquering each subproblem individually and then merging the solutions, this technique allows us to solve intricate challenges efficiently. It is widely used in various domains, such as computer graphics, data analysis, and computational biology.
Source code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
This video explores how to loop through a list using recursion. Source code repository: https://github.com/williamfiset/algorithms Video slides: https://github.com/williamfiset/algorithms/tree/master/slides
This video explores how to loop through a list using recursion.
Source code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
In this video, we dive into the fascinating world of recursive functions and learn how to return multiple values from them. Recursive functions are powerful tools that call themselves repeatedly to solve complex problems by breaking them down into smaller, more manageable...
In this video, we dive into the fascinating world of recursive functions and learn how to return multiple values from them. Recursive functions are powerful tools that call themselves repeatedly to solve complex problems by breaking them down into smaller, more manageable subproblems. Returning multiple values from a recursive function can be particularly useful when you need to gather and analyze various pieces of information during the recursive process.
Source code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Personal website:
williamfiset.com
In this video we explore how to reverse a string using recursion and check whether or not a string is a palindrome using the 'outside-in' method. Source code repository: https://github.com/williamfiset/algorithms Video slides:...
In this video we explore how to reverse a string using recursion and check whether or not a string is a palindrome using the 'outside-in' method.
Source code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Exploring multiplication tackles implementing multiplication recursively without the use of the multiplication operator or loops. Video slides: https://github.com/williamfiset/algorithms/tree/master/slides 0:00 Intro 0:41 The multiplication problem 1:13 Understanding...
Exploring multiplication tackles implementing multiplication recursively without the use of the multiplication operator or loops.
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
0:00 Intro
0:41 The multiplication problem
1:13 Understanding multiplication
3:19 Multiplication pseudocode
5:58 Challenge
6:46 Multiplication full solution
An introduction to recursion and the components that make up a recursive function including the base case, the recursive call (transition), and the body. Source code repository: https://github.com/williamfiset/algorithms Video slides:...
An introduction to recursion and the components that make up a recursive function including the base case, the recursive call (transition), and the body.
Source code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
0:00 Introduction to recursive functions
1:24 Components of recursive functions
1:57 The base case
2:49 The recursive call and the transition
3:35 The body of the function
3:53 The Sum function
5:50 Summary
A generalization of how to solve tiling problems using dynamic programming Previous video: https://youtu.be/gQszF5qdZ-0 Tiling problems: https://projecteuler.net/problem=114 https://projecteuler.net/problem=115 https://projecteuler.net/problem=116...
An introduction on how to solve tiling problems using dynamic programming Next video: https://youtu.be/L1x3an2pl3U Project Euler practice problems: https://projecteuler.net/problem=114 https://projecteuler.net/problem=115 https://projecteuler.net/problem=116...
An introduction on how to solve tiling problems using dynamic programming
Next video:
https://youtu.be/L1x3an2pl3U
Project Euler practice problems:
https://projecteuler.net/problem=114
https://projecteuler.net/problem=115
https://projecteuler.net/problem=116
https://projecteuler.net/problem=117
Algorithms code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Website:
http://www.williamfiset.com
Audio intro/outro composed by Richard Saney (rnsaney@gmail.com)
0:00 Intro
1:23 Top-down approach
3:47 Recursion tree
7:06 Recursive approach code
7:40 Repeating subtrees
8:39 Recursion tree with caching
11:07 Recursive implementation with caching
12:37 Bottom-up approach
15:08 Bottom-up (iterative) implementation
15:50 Related tiling problems
Walkthrough of the Narrow Art Gallery problem that featured in the 2014 ICPC North America qualifier. Narrow Art Gallery problem: https://open.kattis.com/problems/narrowartgallery Source Code:...
Walkthrough of the Narrow Art Gallery problem that featured in the 2014 ICPC North America qualifier.
Narrow Art Gallery problem:
https://open.kattis.com/problems/narrowartgallery
Source Code:
https://github.com/williamfiset/Algorithms/tree/master/src/main/java/com/williamfiset/algorithms/dp/examples/narrowartgallery
Algorithms code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Website:
http://www.williamfiset.com
Audio intro/outro composed by Richard Saney (rnsaney@gmail.com)
0:00 Intro
0:53 Problem description
3:28 Problem hints
4:14 Understanding the NAG problem
5:30 Approach
6:33 Representing states
11:30 Transition and recurrence
14:03 Pseudocode
Source code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Source code repository:
https://github.com/williamfiset/algorithms#graph-theory
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Website:
http://www.williamfiset.com
Audio intro/outro composed by Richard Saney (rnsaney@gmail.com)
0:00 Intro
0:22 Topological sort example
2:09 Topological sort motivation
2:37 Topological ordering
3:36 Directed acyclic graphs
4:31 A case against cycles
5:36 Kahn's algorithm intuition
6:05 Kahn's algorithm example1
7:11 Kahn's algorithm example2
11:15 Kahn's algorithm pseudocode
12:57 Outro
===================================
Practicing for interviews? I have used, and recommend `Cracking the Coding Interview` which got me a job at Google. Link on Amazon: https://amzn.to/3cvMof5
A lot of the content on this channel is inspired by the book `Competitive Programming` by Steven Halim which I frequently use as a resource and reference. Link on Amazon: https://amzn.to/3wC2nix
Graph Theory algorithms video series Support me by purchasing the full graph theory playlist on Udemy. This version offers additional problems, exercises and quizzes not available on YouTube: https://www.udemy.com/course/graph-theory-algorithms Graph Theory video series...
Graph Theory algorithms video series
Support me by purchasing the full graph theory playlist on Udemy. This version offers additional problems, exercises and quizzes not available on YouTube:
https://www.udemy.com/course/graph-theory-algorithms
Graph Theory video series playlist on YouTube:
https://www.youtube.com/playlist?list=PLDV1Zeh2NRsDGO4--qE8yH72HFL1Km93P
Topics covered in these videos include: how to store and represent graphs on a computer; common graph theory problems seen in the wild; tree algorithms; famous graph traversal algorithms (DFS & BFS); Dijkstra's shortest path algorithm; what a topological sort is, how to find one, and places it's used; learning about detecting negative cycles and finding shortest paths with the Bellman-Ford and Floyd-Warshall algorithms; discovering bridges and articulation points in graphs; understanding and detecting strongly connected components with Tarjan's algorithm, how to solve the traveling salesman problem with dynamic programming, a variety of network flow topics and etc...
What you’ll learn:
- Storage and representation of graphs (networks) on a computer
- Common graph theory problems
- A variety of tree algorithms
- Breadth first search algorithm
- Depth first search algorithm
- Dijkstra's algorithm
- Topological sort algorithm
- Shortest/longest path on a acyclic graph
- Bellman Ford's algorithm
- Floyd-Warshall all pairs shortest path algorithm
- Finding bridges/articulation points
- Finding strongly connected components (Tarjan's)
- Travelling salesman problem (TSP)
- Network flow topics such as the Ford Fulkerson method and bipartite graph matching
Are there any course requirements/prerequisites to the series?
- Some prior programming knowledge.
- Exposure to computer science fundamentals such as: data structures, recursion, classes, and OOP will all come handy.
====================================
Practicing for interviews? I have used, and recommend `Cracking the Coding Interview` which got me a job at Google. Link on Amazon: https://amzn.to/3cvMof5
A lot of the content on this channel is inspired by the book `Competitive Programming` by Steven Halim which I frequently use as a resource and reference. Link on Amazon: https://amzn.to/3wC2nix
=================================
Music license obtained from bensound.com
Soundtrack: You got this
Composer: Yan Perchuk
Walkthrough of the Mountain Scenes dynamic programming problem that featured in the 2016 NAIPC programming competition. Mountain Scenes problem: https://open.kattis.com/problems/scenes Source Code:...
Walkthrough of the Mountain Scenes dynamic programming problem that featured in the 2016 NAIPC programming competition.
Mountain Scenes problem:
https://open.kattis.com/problems/scenes
Source Code:
https://github.com/williamfiset/Algorithms/tree/master/src/main/java/com/williamfiset/algorithms/dp/examples/scenes
Algorithms code repository:
https://github.com/williamfiset/algorithms
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Website:
http://www.williamfiset.com
Audio intro/outro composed by Richard Saney (rnsaney@gmail.com)
0:00 Intro
0:35 Mountain scenes problem statement
2:20 Problem hints
3:00 Problem analysis
3:38 Counting the total number of scenes
9:08 Counting plain scenes
11:00 Psuedocode
Explanation video on how to tile a 2xN grid with dominoes and L shaped trominoes. Leetcode problem: https://leetcode.com/problems/domino-and-tromino-tiling/ Source code:...
Explanation video on how to tile a 2xN grid with dominoes and L shaped trominoes.
Leetcode problem:
https://leetcode.com/problems/domino-and-tromino-tiling/
Source code:
https://github.com/williamfiset/Algorithms/tree/master/src/main/java/com/williamfiset/algorithms/dp/examples/dominoandtrominotiling
Algorithms repo:
https://github.com/williamfiset/algorithms
Previous video on tiling dominoes:
https://www.youtube.com/watch?v=yn2jnmlepY8
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Website:
http://www.williamfiset.com
Audio intro/outro composed by Richard Saney (rnsaney@gmail.com)
0:00 Intro
0:31 Tiling dominoes and trominos problem statement and examples
2:02 Problem hints
3:15 Problem analysis
6:45 State transition
8:45 Pseudocode
===============================================================================
Developer tools I used in the creation/testing of the content in these videos:
1) Sublime text, my favorite lightweight code editor (https://www.sublimetext.com).
NOTE: I'm often asked about the color scheme I use, find it here: https://github.com/williamfiset/dotfiles/tree/master/sublime
2) Kite, a free AI-powered coding assistant that provides smart code completions while typing:
https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=williamfiset&utm_content=description-only
===============================================================================
Walkthrough of dynamic programming on how to tile dominoes on a grid. Problem: https://open.kattis.com/problems/tritiling Source code: https://github.com/williamfiset/Algorithms/tree/master/src/main/java/com/williamfiset/algorithms/dp/examples/tilingdominoes Video slides:...
Walkthrough of dynamic programming on how to tile dominoes on a grid.
Problem:
https://open.kattis.com/problems/tritiling
Source code:
https://github.com/williamfiset/Algorithms/tree/master/src/main/java/com/williamfiset/algorithms/dp/examples/tilingdominoes
Video slides:
https://github.com/williamfiset/algorithms/tree/master/slides
Website:
http://www.williamfiset.com