Algoritmi e strutture dati

Complessità, grafi, cammini minimi, flusso massimo, programmazione dinamica e progettazione degli algoritmi.

Percorso di lettura

Questa sezione collega i concetti fondamentali ai libri che utilizzo come riferimento. Parto da un problema, individuo l’argomento e torno ai capitoli utili per comprenderlo.

Libri e percorsi della sezione

  • Introduction to Algorithms
  • Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest & Clifford Stein
  • Steven S. Skiena
  • CLRS
  • Skiena
  • Distributed Systems
  • Databases
  • Cybersecurity & Cryptography

I titoli dei libri e le note dettagliate sui capitoli sono conservati nella lingua originale.

Leggi le note complete in inglese

Algorithms & Data Structures

From computational complexity to graphs, optimisation problems and algorithm design.

Algorithms are one of the areas I wanted to revisit most deeply.

It is easy, after years of software development, to remember how to use a data structure or recognise the name of an algorithm while gradually forgetting the reasoning behind it.

Why does it work? What assumptions does it rely on? How does the choice of data structure affect its complexity? How can a real-world problem be recognised as a shortest-path, matching, flow or optimisation problem?

This section collects the books I use to reconnect practical problem solving with the theoretical foundations of algorithms.


Topics in This Section

Complexity Analysis · Data Structures · Sorting · Graph Traversal · Shortest Paths · Minimum Spanning Trees · Maximum Flow · Bipartite Matching · Dynamic Programming · Greedy Algorithms · NP-Completeness · Approximation Algorithms


Introduction to Algorithms

Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest & Clifford Stein

4th Edition — MIT Press

Level
Foundation → Advanced

Best for
Rigorous understanding, theoretical foundations and reference.

Introduction to Algorithms, often referred to as CLRS, is one of the main academic references I use for this area.

What I find particularly valuable is that it does not simply present algorithms as recipes. It explains their correctness, computational complexity and the assumptions that make them applicable.

The chapters are largely self-contained, which also makes the book useful as a reference: it is possible to return directly to a specific topic without reading the entire book sequentially.

What I Use It For

  • analysing time and space complexity;
  • understanding the mathematical reasoning behind algorithms;
  • selecting appropriate data structures;
  • graph modelling;
  • shortest-path problems;
  • minimum spanning trees;
  • network flow;
  • bipartite matching;
  • dynamic programming;
  • greedy strategies;
  • complexity classes and NP-completeness;
  • approximation algorithms.

Chapters Worth Reading

Foundations

Chapter 2 — Getting Started
Algorithm analysis and basic design principles.

Chapter 3 — Characterizing Running Times
Asymptotic notation, including O, Θ and Ω.

Chapter 4 — Divide-and-Conquer
Recurrences, recursion trees and techniques for analysing recursive algorithms.

Chapter 5 — Probabilistic Analysis and Randomized Algorithms
Randomised algorithms and probabilistic reasoning.

Core Data Structures

Chapter 6 — Heapsort
Heaps and priority queues.

Chapter 10 — Elementary Data Structures
Arrays, stacks, queues, linked lists and tree representations.

Chapter 11 — Hash Tables
Hash functions, collision management and open addressing.

Chapter 12 — Binary Search Trees

Chapter 13 — Red-Black Trees

Chapter 16 — Amortized Analysis
Understanding why a sequence of operations can remain efficient even when individual operations may occasionally be expensive.

Chapter 19 — Data Structures for Disjoint Sets
Union-Find, union by rank and path compression.

Algorithm Design

Chapter 14 — Dynamic Programming
Recognising problems characterised by overlapping subproblems and optimal substructure.

Chapter 15 — Greedy Algorithms
Understanding when locally optimal choices can lead to a globally optimal solution.

Graph Algorithms

Chapter 20 — Elementary Graph Algorithms

  • graph representations;
  • Breadth-First Search;
  • Depth-First Search;
  • topological sorting;
  • strongly connected components.

Chapter 21 — Minimum Spanning Trees
Including Kruskal’s and Prim’s algorithms.

Chapter 22 — Single-Source Shortest Paths

  • Bellman-Ford;
  • shortest paths in DAGs;
  • Dijkstra.

Chapter 23 — All-Pairs Shortest Paths
Including Floyd-Warshall and Johnson’s algorithm.

Chapter 24 — Maximum Flow
Flow networks, Ford-Fulkerson and applications to matching.

Chapter 25 — Matchings in Bipartite Graphs
Matching problems and related algorithms.

Computational Complexity

Chapter 34 — NP-Completeness

  • polynomial time;
  • verification;
  • reductions;
  • NP-completeness proofs;
  • classical NP-complete problems.

Chapter 35 — Approximation Algorithms
Approximation approaches for computationally difficult optimisation problems.

My Suggested Learning Path

Complexity
Chapters 2–3

Core Data Structures
Chapters 6, 10–13, 19

Algorithmic Thinking
Chapters 14–15

Graphs
Chapters 20–25

Hard Computational Problems
Chapters 34–35


The Algorithm Design Manual

Steven S. Skiena

3rd Edition

Level
Foundation → Intermediate

Best for
Practical problem recognition and algorithm selection.

If CLRS answers:

How does this algorithm work, and why is it correct?

Skiena’s book is particularly good at helping answer another question:

What kind of algorithmic problem am I actually looking at?

That distinction is one of the reasons I keep both books in this library.

What I Use It For

  • recognising algorithmic patterns in real-world problems;
  • estimating complexity before implementing a solution;
  • choosing appropriate data structures;
  • graph traversal;
  • weighted graph problems;
  • dynamic programming;
  • combinatorial search;
  • identifying computationally hard problems;
  • deciding what to do when an exact polynomial-time algorithm is unlikely to exist.

Chapters Worth Reading

Foundations & Data Structures

Chapter 1 — Introduction to Algorithms
Algorithmic reasoning, correctness and counterexamples.

Chapter 2 — Algorithm Analysis
Complexity and performance analysis.

Chapter 3 — Data Structures
Selecting data structures according to the operations required by a problem.

Chapter 4 — Sorting
Sorting algorithms and their role as building blocks for other problems.

Chapter 5 — Divide and Conquer
Breaking problems into smaller independent subproblems.

Chapter 6 — Hashing and Randomized Algorithms
Hashing and probabilistic approaches.

Graphs & Problem Solving

Chapter 7 — Graph Traversal
Graph representation, BFS, DFS, connectivity and traversal-based problem solving.

Chapter 8 — Weighted Graph Algorithms
Weighted graphs, shortest-path problems and spanning trees.

Chapter 9 — Combinatorial Search
Systematic exploration of large solution spaces.

Chapter 10 — Dynamic Programming
Recognising and solving problems with overlapping subproblems.

Hard Problems

Chapter 11 — NP-Completeness
Understanding when a problem is likely to be computationally difficult.

Chapter 12 — Dealing with Hard Problems
Heuristics, approximation and alternative strategies when an efficient exact solution is unlikely.


Why I Keep Both Books

CLRS

Theory first.

  • correctness;
  • mathematical foundations;
  • detailed complexity analysis;
  • internal mechanics of algorithms.

Skiena

Problem first.

  • recognising the problem family;
  • identifying candidate algorithms;
  • practical algorithm selection;
  • alternatives when exact solutions are difficult.

Together they cover two complementary skills: understanding algorithms and recognising when to use them.


Topic → Book Map

Complexity Analysis

CLRS: Chapters 2–4
Skiena: Chapter 2

Data Structures

CLRS: Chapters 6, 10–13, 19
Skiena: Chapter 3

Graph Traversal

CLRS: Chapter 20
Skiena: Chapter 7

Minimum Spanning Trees

CLRS: Chapter 21
Skiena: Chapter 8

Shortest Paths

CLRS: Chapters 22–23
Skiena: Chapter 8

Maximum Flow & Matching

CLRS: Chapters 24–25
Skiena: graph-related sections and algorithm catalogue.

Dynamic Programming

CLRS: Chapter 14
Skiena: Chapter 10

NP-Completeness

CLRS: Chapter 34
Skiena: Chapter 11

Approximation & Hard Problems

CLRS: Chapter 35
Skiena: Chapter 12


How I Use These Books

My goal is rarely to read an algorithms textbook sequentially. Instead, I normally start from a problem.

“I need to connect all these nodes at minimum total cost.”

That points towards Minimum Spanning Trees. I can first use Skiena to understand the problem family and possible approaches, then move to CLRS for the detailed treatment of Prim and Kruskal.

“I need to maximise the amount that can travel through a network with capacity constraints.”

That points towards Maximum Flow. From there I can study flow networks and Ford-Fulkerson in CLRS and connect the same model to problems such as bipartite matching.

Start from a question, identify the underlying concept, then know exactly where to study it.


Related Areas

Algorithms rarely exist in isolation. They naturally connect with several other areas in this library.

Distributed Systems

Graphs, consensus, routing, scheduling and optimisation.

Databases

Indexes, B-trees, hashing, query optimisation and data structures.

Machine Learning & AI

Optimisation, gradient descent, graph algorithms and computational complexity.

Cybersecurity & Cryptography

Number-theoretic algorithms, modular arithmetic and computational hardness.


Torna alla biblioteca