Algorithmic Thinking: A Problem-Based Introduction Homepage for the book Algorithmic Thinking: A Problem-Based Introduction

Solution to the Alchemist Problem

My algorithmists! It’s time to solve the Alchemist problem from last time. Please revisit that post to get up to speed with this problem. And, if you haven’t tried to solve it yourself yet, do give it a go! (Check the bottom of that post for some hints.) If you’re ready… Alkemija, Attempt 2 Last time, I presented some code that was too slow ... Read more

Reacting to an Alchemist Problem

Hello, algorithms people! I love finding challenging problems that use hash tables or recursion or dynamic programming or graphs or binary search or segment trees or… all of the stuff that I go over in my Algorithmic Thinking book. But you know? Sometimes there’s a problem that doesn’t use any of those things – and, still, it’s so neat that I ... Read more

Solving the MooTube USACO Problem Using Depth-First Search

Hi everyone, In a previous post, we solved the MooTube problem using breadth-first search. I noted there that we didn’t need to keep track of the minimum number of moves (even though I did so to keep close to the breadth-first search code from the book). If we’re using breadth-first search but we don’t care about shortest paths, then we may a... Read more

Binary Search, or Equations, or Pizzas?

Hi all, I recently found a neat little COCI problem on DMOJ. Check it out! (If you’re put off that it’s only a 3-point problem: give it a chance, there may still be some learning for you here.) Binary Search OK, so we have a snail climbing a pole. Every day it climbs up $a$ meters and then, at night, slides down $b$ meters. How long does the... Read more

More Exercises

Hi everyone, Just a quick note to say that I’ve filled out more of the exercises page. It’s a small number of hand-picked exercises for you, categorized by chapter, hopefully useful to you if you’d like additional practice with the book material. Have fun :) and if you have any great exercises to share, please do so! I’d be grateful for your ... Read more