Data Structures

Knowing your data structures is an important part of programming! Using the right structure can make a huge difference in how efficient your code is, allowing you to solve more complicated problems in less time.

Any time you start learning a new language, tutorials will teach you how to use the most basic structures, but you'll be on your own for the more advanced concepts you'll need for more difficult problems.

With that in mind, I decided to make this series on using data structures in Haskell. We'll start with basics like lists, sets, and maps, but we'll also cover arrays, sequences and heaps, which you won't see in many tutorials but which are very useful for problem solving.

When you learn a structure, it can be a little overwhelming to keep track of all the API functions you'll want. In this series, we'll break each structure down into 10 Steps of Understanding.

  1. What operations does it support most efficiently? (What is it good at?)
  2. What is it not as good at?
  3. How many parameters does the type use and what are their constraints.
  4. How do I initialize the structure?
  5. How do I get the size of the structure?
  6. How do I add items to the structure?
  7. How do I access (or get) elements from the structure?
  8. If possible, how do I delete elements from the structure?
  9. How do I combine two of these structures?
  10. How should I import the functions of this structure?

This sounds like a lot of steps, but each step shouold be short! We'll just cover the most important functions in the API for that type. We'll start with the simplest types and work our way up!

1. Lists

2. Sets

3. Maps

4. Hash Sets

5. Hash Maps

6. Arrays

7. Vectors

8. Sequences

9. Heaps