
This video gives an overview of the entire course.
In this video we explain why some sorting techniques and why they are important. Sorting can be quite difficult to implement in an immutable fashion. Here we discuss why this is, and which ones perform better.
In this video clip we have a look at how bubble sorting works.
Here we will build a bubble sort function in Scala using several tools and techniques.
In this video we will demonstrate a faster sorting algorithm called Merge Sort. Merge Sort is much faster algorithm than Bubble Sort and it’s easier to implement in a functional manner.
In this video we implement the Merge Sort algorithm in a functional manner in Scala.
In this video we define what we mean by substring searching. We give an example problem where substring searching would be useful.
In this video we show how the substring search can be implemented in a naïve simple manner.
In this video clip we discuss what’s so special about the Scala’s string and implement the algorithm discussed in the previous video.
Here we revisit the naïve substring search implementation and try to re-implement it in a more functional manner.
In this video we present an alternative faster technique to the substring search problem. The method can be split in two, building the prefix table and matching the substring. Here we explain both.
In this clip we implement the matching part of this KMP substring search problem in Scala.
In this video we implement the generation of the KMP prefix lookup table for the substring search problem in Scala.
In this video we discuss the problem of organizing your data so it’s easily accessible. We introduce hash tables through an example problem and through a direct addressing technique.
In this video we show how to deal with the two aspects of hash tables, collisions and hashing. We mention two ways of handling collisions and various hashing techniques.
In this video clip we present two types of Hash Table APIs, a mutable and an immutable version. We also see new Scala concepts such astype parameters.
In this clip we show to implement a mutable hash table in Scala.
Here we explain the problem of building an efficient immutable hash table. We introduce the concept of persistent data structures and structural sharing.
After explaining persistent hash tables in the previous clip, in this video we show how to implement one of them.
In this video we introduce binary trees. We discuss how they can be used to organize your ordered data in an efficient manner.
Here we show how the traditional mutable binary tree operations can be adapted into an immutable manner. We do this by maximizing structural sharing.
In this video clip we demonstrate how to implement the search operation on binary trees in Scala.
In this clip we show how to develop the immutable insert operation for unbalanced binary trees.
In this video we present algorithms that traverse binary trees. We explain how different depth first searches work and how their output differs. We also examine the breadth first search and discuss how it differs from depth first.
In this clip we show to develop, in Scala, the traversal algorithms discussed in the previous video. We code both depth and breadth first search functions.
Here we introduce balanced binary trees. Specifically we talk about red black trees and the rules that govern them.
In this video we implement the left and right tree rotations while maintaining tree immutability.
In this video we show the insert in a red black tree works. We explain the four cases with inserting in the tree structure and in each case we describe what needs done to keep the tree balanced.
In this video we implement the functional insert algorithm we discussed in the previous section.
In this video we present the closest pair problem and discuss a simple but inefficient brute force solution.
Here we start building our general solution slowly. We do this by simplifying the problem to one dimension and discuss the technique of finding the closest pair.
In this video we show how to implement the algorithm for finding the closest pair in 1 dimension in Scala.
In this video we extend the algorithm to handle an extra y dimension. We do this by highlighting the key differences from the one dimension and showing an example scenario.
Here we do a code walkthrough for the final solution of the closest pair problem in two dimensions.
Scala's functional programming features are a boon when it comes to designing easy-to-reason-about systems to curb growing software complexities. In this course, we will learn about many concepts and tools available in the Scala language by implementing, in a functional manner, some sorting and searching algorithms.
Most algorithms are traditionally defined in an imperative manner, typically consisting of repetitions in the form of conditional looping and altering states. Writing these in a functional manner is not always a trivial process. In this course, we will do just that. We will also show how to implement search data structures in a functional and immutable manner. We will look at number sorting, substring searches, hash tables, red black binary trees, and the closest pair algorithm. Along the way, we will talk about bubble sort, merge sort, Knuth-Morris-Pratt string searching, structural sharing in functional data structures, and various problems with immutable data structures. Further, we will explore the classic closest pair algorithm and show how we can solve the problem efficiently in a functional manner.
By the end of the course, you will have gained a thorough knowledge of many functional Scala concepts and will understand these algorithms and data structures.
About the Author
James Cutajar is a software developer with interests in scalable high-performance computing and distributed algorithms. He is also an open source contributor, author, blogger, and tech evangelist. When he is not writing software, he rides his motorbike, surfs, or flies light aircraft. He was born in Malta, lived for almost a decade in London, and is now working in Portugal.