Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Sorting and Searching Algorithms in Scala
Rating: 4.1 out of 5(17 ratings)
160 students

Sorting and Searching Algorithms in Scala

Learn functional programming in Scala by implementing sorting and searching algorithms.
Last updated 7/2018
English

What you'll learn

  • Understand and implement bubble sort and a functional merge sort
  • Explore naive string searching and the more advanced KMP algorithm.
  • Implement a purely functional hash table
  • Learn about structural searching
  • Master unbalanced binary and red-black trees and implement both in a functional manner
  • Understand depth and breadth-first search traversal
  • Implement an efficient solution for the closest pair problem.

Course content

5 sections34 lectures5h 16m total length
  • The Course Overview3:51

    This video gives an overview of the entire course.                   

  • Can Sorting Be Functional11:00

    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.

    • Learn the basic principles in functional programming
    • Find out why sorting is important for other algorithms
    • Understand why some sorting techniques are more suited for functional programming 
  • Bubble Sort4:00

    In this video clip we have a look at how bubble sorting works.

    • Have a look at an example of bubble sorting
    • Watch how the sorted list forms in our example
    • Read the bubble sort pseudocode  
  • Bubble Sort Implementation11:37

    Here we will build a bubble sort function in Scala using several tools and techniques.

    • Find out how to use comprehensions in Scala.
    • Learn how to do pattern matching with guards
    • See different variations of the Bubble Sort implementation
  • Merge Sort8:32

    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.

    • Understand what class of algorithm the Merge Sort is
    • Walkthrough a list sorting example
    • Understand how the sorting works by gradually building the pseudocode
  • Merge Sort Implementation14:19

    In this video we implement the Merge Sort algorithm in a functional manner in Scala.

    • Learn how the splitAt function works
    • Have a look at pattern matching on Lists
    • Understand how the Scala Merge Sort implementation works

Requirements

  • Should have basic understanding of Scala programming.

Description

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.

Who this course is for:

  • This course is aimed at intermediate Scala developers who want to learn in depth about functional programming concepts in Scala. This course will help intermediate developers understand some of the more complex Scala tools by practising with searching and sorting algorithms and their functional implementations.