This repository has the implementations of various algorithms and data structures. Everything is implemented in Haskell. Most, if not all, algorithms and data structures use recursion in some way. The primary goal of the repository is to have a collection of high-performance and, preferably, minimal implementations of algorithms and data structures.
Haskell's type system allows for very expressive code. Functions are first-class citizens (think of variables) which opens up a whole new world of algorithms and data structures. Furthermore, so-called divide-and-conquer approach to problem-solving (breaking down a problem into simple steps and dealing with the smaller subproblems making the problem-solving a lot more efficient) comes naturally with Haskell and is endorsed by the philosophy and design of the language. Besides, its lazy evaluation by default can make algorithms run extremely fast by not computing the values which are not going to be used.
Basic data structures
Geometric data structures
Searching algorithms
Sorting algorithms
- Bogosort (DO NOT RUN ON YOUR MACHINE! If interested, just look at the implementation)
- Bubble sort
- Counting sort
- Insertion sort
- Merge sort
- Quicksort
- Selection Sort
- Shellsort
Sequence generation algorithms
- Arithmetic Sequence Generator
- Calkin-Wilf Sequence Generator
- Catalan Sequence Generator
- Collatz Sequence Generator
- Stern's Diatomic Sequence Generator
- Fibonacci Sequence Generator
- Geometric Sequence Generator
- Lazy Caterer's Sequence Generator
- Magic Square Sequence Generator
- Prime Sequence Generator
- Recamán's Sequence Generator
Miscellaneous algorithms