Contents

Introduction

Chapter 1 Algorithm Basics

Approach

Algorithms and Data Structures

Pseudocode

Algorithm Features

Big O Notation

Common Runtime Functions

Visualizing Functions

Practical Considerations

Summary

Exercises

Chapter 2 Numerical Algorithms

Randomizing Data

Generating Random Values

Randomizing Arrays

Generating Nonuniform Distributions

Finding Greatest Common Divisors

Performing Exponentiation

Working with Prime Numbers

Finding Prime Factors

Finding Primes

Testing for Primality

Performing Numerical Integration

The Rectangle Rule

The Trapezoid Rule

Adaptive Quadrature

Monte Carlo Integration

Finding Zeros

Summary

Exercises

Chapter 3 Linked Lists

Basic Concepts

Singly Linked Lists

Iterating Over the List

Finding Cells

Using Sentinels

Adding Cells at the Beginning

Adding Cells at the End

Inserting Cells After Other Cells

Deleting Cells

Doubly Linked Lists

Sorted Linked Lists

Linked-List Algorithms

Copying Lists

Sorting with Insertionsort

Linked List Selectionsort

Multithreaded Linked Lists

Linked Lists with Loops

Marking Cells

Using Hash Tables

List Retracing

List Reversal

Tortoise and Hare

Loops in Doubly Linked Lists

Summary

Exercises

Chapter 4 Arrays

Basic Concepts

One-dimensional Arrays

Finding Items

Finding Minimum, Maximum, and Average

Inserting Items

Removing Items

Nonzero Lower Bounds

Two Dimensions

Higher Dimensions

Triangular Arrays

Sparse Arrays

Find a Row or Column

Get a Value

Set a Value

Delete a Value

Matrices

Summary

Exercises

Chapter 5 Stacks and Queues ...

Get Essential Algorithms: A Practical Approach to Computer Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.