© 2019

First Course in Algorithms Through Puzzles


Table of contents

  1. Front Matter
    Pages i-xi
  2. Ryuhei Uehara
    Pages 1-42
  3. Ryuhei Uehara
    Pages 43-55
  4. Ryuhei Uehara
    Pages 57-87
  5. Ryuhei Uehara
    Pages 89-109
  6. Ryuhei Uehara
    Pages 111-127
  7. Ryuhei Uehara
    Pages 129-139
  8. Ryuhei Uehara
    Pages 141-143
  9. Ryuhei Uehara
    Pages 145-170
  10. Back Matter
    Pages 171-175

About this book


This textbook introduces basic algorithms and explains their analytical methods. All algorithms and methods introduced in this book are well known and frequently used in real programs. Intended to be self-contained, the contents start with the basic models, and no prerequisite knowledge is required. This book is appropriate for undergraduate students in computer science, mathematics, and engineering as a textbook, and is also appropriate for self-study by beginners who are interested in the fascinating field of algorithms.

More than 40 exercises are distributed throughout the text, and their difficulty levels are indicated. Solutions and comments for all the exercises are provided in the last chapter. These detailed solutions will enable readers to follow the author’s steps to solve problems and to gain a better understanding of the contents.

Although details of the proofs and the analyses of algorithms are also provided, the mathematical descriptions in this book are not beyond the range of high school mathematics. Some famous real puzzles are also used to describe the algorithms. These puzzles are quite suitable for explaining the basic techniques of algorithms, which show how to solve these puzzles.


Algorithms Data Structure Algorithm Analysis Computer Programming Puzzle

Authors and affiliations

  1. 1.Japan Advanced Institute of Science and TechnologyNomiJapan

About the authors

Ryuhei Uehara is a professor in the School of Information Science at the Japan Advanced Institute of Science and Technology. He was a researcher at CANON Inc. Later, he joined Tokyo Woman's Christian University as an assistant professor and was later also a lecturer and associate professor at Komazawa University. He had been a visiting scholar at the University of Waterloo (Canada), the Massachusetts Institute of Technology (USA), Simon Fraser University (Canada), the Université libre de Bruxelles (Belgium), ETH  Zürich (Switzerland), and the Universitat Politècnica de Catalunya (Spain).  His research interests include computational complexity, algorithms and data structures, and graph algorithms. He is especially engrossed in computational origami, games, and puzzles from the viewpoints of theoretical computer science. He is one of two translators of the New Martin Gardner Mathematical Library into Japanese.

Bibliographic information

Industry Sectors
Materials & Steel
IT & Software
Consumer Packaged Goods
Finance, Business & Banking
Energy, Utilities & Environment


“Uehara’s First course in algorithms through puzzles is an immensely gratifying book to read. It is a neat and short introduction to algorithms, which manages to combine fun with depth. … This reviewer is thinking of employing Uehara's book as recommended reading.” (Michael Soltys, Mathematical Reviews, May, 2020)

“This is a first course in computer-science algorithms, aimed at undergraduates.  … The puzzle parts are the best part of the book. They are concrete, well-explained, and well-motivated, as well as being rigorous computer science.” (Allen Stenger, MAA Reviews, April 22, 2019)