DEV Community

Cover image for Book review: "Bad choices, how algorithms can help you think smarter and live happier" by Ali Almssawi
Anna Eliz
Anna Eliz

Posted on

Book review: "Bad choices, how algorithms can help you think smarter and live happier" by Ali Almssawi

It's time for "Bad choices, How algorithms can help you think smarter and live happier" by Ali Almossawi.

Alt Text

In my opinion, this is a book for non-developers who want to understand algorithms. Sometimes people ask me --since they know I have read some basic algorithms books-- which book is better to get started with algorithms, and the answer depends on the knowledge the person has. I believe this book is for those who don't have any relevant experience with code. In my first post I mentioned, I joined an algorithm club full of talented developers and algorithmic engineers, without knowing anything about algorithms. I consider this book may have been the best start for me at that moment.

Ali Almossaw, is the author of one of the most complicated books I have ever read; full of lovely pictures, but also full of tough concepts, its name is "An Illustrated Book of Bad Arguments.". By getting to know more about this author, we are able to assume that every of his books have lots of pictures. Pictures make the learning process easier, and I think this is what the author wants to pursuit.

I personally believe that when you are just learning algorithms in general, there are 2 paths to follow:. The one that starts just understanding general ideas and the other one that actually push you to go deeper.
This book will walk you through the first path —the one that will give you just an idea of algorithms. If you are willing to code with this book, you are in the wrong place, but if you are a curious non-developer, or a Jr. programmer eager to understand a general idea, this will be a good choice -which is funny because of the name of the book.-

Remember when I told you about pictures? Actually the table itself has a character.

One of the things that I like the most about this book, is that it encourages the reader to have "an algorithmic thinking" (This is exiting, Do you get what I feel? (Are we having the same feeling? no? uh...?) it motivates you to analyse how our lives are full of problems and we are constantly designing algorithms to solve them, but sometimes we make bad choices. By taking a moment and analyzing the methods/algorithms to solve a problem, we can find out effective ways to get better solutions, this is part of what is called Big O notation.

Alt Text

Do you see it? A general notion of Big O notation is given smoothly. I don´t know if the same happened to you, but I got frustrated many times by not understanding Big O, stunningly you will find Big O on the whole book, without even noticing it.

Alt Text

It shows us some scenarios of people with common problems, and methods to solve, because there always are many ways to solve a problem. Normal people, with normal problems, like matching socks, sorting books, picking a t-shirt on a store, buying grocery or choosing a record. At the very beginning, we may think that sorting is not a big deal. The general idea of sorting or searching can be easy, but what if I tell you that there are different methods of sorting and searching. If you are related with code you may think about some sorting/searching methods like binary search, linear search, bubble sort, insertion sort or merge sort, but if you are not related with code, this may seem confusing.

One of the scenarios is about a lady purchasing clothes in black Friday. In order to be quick and be able to pick as many clothes in a minimum amount of time, she needs to be fast. The problem is:, "how to search". Think about this, if she goes one rack by one at a time through every item in the rack, she will have linear time complexity of her searching algorithm. Maybe, if the store is small, this should not be a problem, but remember that it is black Friday. She is medium size, if she starts at the middle of the sorted rack, and then she checks for the size of the item, she can go left or right depending on the size, so, she will save valuable time, to buy more.

The first method used is called linear search and the second one is called binary search, those are commonly used.

Alt Text

Imagine you have to sort a bunch of something. If you have 10 items and you go one by one, it may not seem hard,. but what if you have 100 items, the work gets complicated, right? There is a technique called Divide and conquer that aim you to break a collection of items into smaller collections and sort them, like we did before with the searching. This, logically, will take half of the time than the first approach that was going one by one.

The first approach has a quadratic run time complexity, since in order to sort every part of the collection, you have to compare each item with the whole data collection, this is called bubble sort and the second one will be the inverse, witch is logarithmic and is commonly known as merge sort.

Alt Text

The book does not give a deep explanation of rates of growth, it keep everything on a general idea but it leaves a description of constant, logarithmic, linear, linearithmic, quadratic, and exponential time complexities.

Recently, someone asked me the difference between a queue and a stack (data structures) and it may sound ridiculous, but I thought about a stack of dishes and a queue of shopping carts, that's how I learned about them, and even now I remember that.

You will find the same on this book, it gives you a walk through data structures like arrays, linked lists, trees, maps and hash tables with daily common examples that can be easily remembered if you are eager to keep learning.

Alt Text


this book won´t teach you how to organize socks, but crating a critical thinking, algorithmic thinking is a highly capable tool that has the potential to impact behavior for the better.

Alt Text

So prepare yourself padawan, in order to join a world full of interesting knowledge, because what this book can give you is a generic view of an algorithmic word. Now you know a basic, BASIC, BASIC way to recommend or start with algorithms. I hope you get fun reading this book and enjoy it as I did.

Special thanks to my best friend who is always supporting me and helped editing this post.

Top comments (0)