I just finished The CS Detective by Jeremy Kubica. It is a story of an officer kicked off the police force, turned private investigator. The narrative is a fictional mystery that has the goal of explaining search algorithms and data structures to organize and process searching. The author is a principal engineer at Google with a PhD in robotics from Carnegie Mellon University and a BS in computer science from Cornell University. He is the author of a previous book Computational Fairy Tales.
The book starts off smoothly but before long the setting leaves the simple P.I. noir expectation when there is a reference to the kingdom and wizards. This could make for a weird story with a world where magic exists. Once you push past that fact, you can continue the story of files stolen from the police precinct and the police chief asking our P.I. Frank Runtime to investigate given the possibility of an insider threat. There are also rules to the magic which makes it more limited and just another element of the story.
With each chapter, more characters are introduced and the plot thickens. Search algorithms are also explained when they make sense. For example, a breadth-first search might be used to follow clues or find a way through a maze. Priority queues, heaps, and binary trees are just some of the concepts explained with practical examples of why you might use one search versus another (efficiency or indexed data, usually). There are images sprinkled throughout the book and at the end of the chapters that teach a lesson there are “lecture excerpts” from the police academy.
The magic in the story is much more simple than one might think could be world-turning. Instead, it is usually just handy abilities like creating a torch for light, or speeding up the rusting of metal to weaken it. Another ability is to perform searches on data. The magician might build the array and then perform the search or sort in the air with the array.
I think the book would be good for high school – college level students interested in search algorithms or computer science in general. I enjoyed the book and the refresher on some CS topics. The story was good enough to keep you interested throughout. You have to accept that you’re reading a book about search algorithms with a narrative over top of it and not the next great novel that will make you rethink everything. The writing didn’t get in the way and in true mystery fashion, a little twist and a clean wrap-up later resolved the original problem and left characters ready for their next adventure.
“My friend here just graduated from the police academy, and I’m told she scored top marks in crossbow usage.”
“I was second, actually,” said Notation from the doorway.
Frank sighed. “Really? This is the one time you decide to be modest?”
“Sorry. I just wanted to be accurate.”
“It’s a threat, Notation. You’re allowed to embellish threats.”
“Sorry,” she repeated.
“Anyways, the point remains. She has a crossbow and knows how to use it better than all but one of her classmates. Please hand over the torch.”