# Data Structures & Algorithms in Dart

Take your programming skills to the next level. Learn to build stacks, queues, trees, graphs, and efficient sorting and searching algorithms from scratch. By Jonathan Sande.

## Who is this for?

This book is for programmers who are familiar with the Dart language but would like to improve the efficiency of their code and take their skills to the next level.

## Covered concepts

- Big O Notation
- Dart Lists, Sets and Maps
- Stacks
- Linked Lists
- Doubly Linked Lists
- Queues
- Ring Buffers
- Recursion
- Binary Trees
- AVL Trees
- Tries
- Heaps
- Priority Queues
- Graphs
- Binary Search
- Breadth-First Search
- Depth-First Search
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Radix Sort
- Heapsort
- Quicksort
- Dijkstra’s Algorithm

Perhaps you’ve heard about Big O notation, stacks and queues, or bubble sort and quicksort. You’d like to learn more, but it’s hard to find any good examples and explanations that use your favorite programming language, Dart.

*Data Structures & Algorithms in Dart* is here to help with in-depth explanations,...

## Before You Begin

This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.

## Section I: Introduction

The chapters in this short but essential section will provide the foundation and motivation for studying data structures and algorithms. You’ll also get a quick rundown of the Dart core library, which you’ll use as a basis for creating your own data structures and algorithms.

## Section II: Elementary Data Structures

This section looks at a few important data structures that are not found in the dart:core library but form the basis of more advanced algorithms covered in future sections. All are collections optimized for and enforcing a particular access pattern.

The dart:collection library, which comes with Dart, does contain LinkedList and Queue classes. However, learning to build these data structures yourself is why you’re reading this book, isn’t it?

Even with just these basics, you‘ll begin to start thinking “algorithmically” and see the connection between data structures and algorithms.

## Section III: Trees

Trees are another way to organize information, introducing the concept of children and parents. You’ll take a look at the most common tree types and see how they can be used to solve specific computational problems. Trees are a handy way to organize information when performance is critical. Having them in your tool belt will undoubtedly be useful throughout your career.

To start your study of trees, you’ll learn about an important concept called recursion, a technique that makes it much easier to visit all of the branches and nodes of a tree-like data structure.

## Section IV: Sorting Algorithms

Putting lists in order is a classical computational problem. Although you may never need to write your own sorting algorithm, studying this topic has many benefits. This section will teach you about stability, best- and worst-case times, and the all-important technique of divide and conquer.

Studying sorting may seem a bit academic and disconnected from the “real world” of app development, but understanding the tradeoffs for these simple cases will lead you to a better understanding of how to analyze any algorithm.

## Section V: Graphs

Graphs are an instrumental data structure that can model a wide range of things: webpages on the internet, the migration patterns of birds, and even protons in the nucleus of an atom. This section gets you thinking deeply (and broadly) about using graphs and graph algorithms to solve real-world problems.

## Section VI: Challenge Solutions

This section contains all of the solutions to the challenges throughout the book. They’re printed here for your convenience and to aid your understanding, but you’ll receive the most benefit if you attempt to solve the challenges yourself before looking at the answers.

The code for all of the solutions is also available for download in the supplemental materials that accompany this book.