Algorithms: Absolute Beginner's Guide |
Author: Kirupa Chinnathambi Subtitled 'a practical introduction to data structures and algorithms in JavaScript', this book is split into two parts; firstly, data structures, then algorithms. Kirupa Chinnathambi has an easy going writing style and explains ideas well using good analogies. He has a popular blog on programming, and works at Microsoft on the Visual Studio team. The book opens with a chapter introducing the need for data structures, followed by individual chapters on each of the data structures in more detail. Interestingly, Chinnathambi's first detailed chapter is about big-O notation and complexity analysis, the title of which I think would scare off many of the potential readers of the book. The explanation (big-O as a mathematical way to express the worst case scenario of how well code runs) is fine and understandable, and the reasoning seems to be that Chinnathambi uses the notation to analyze and compare the different algorithms. It just seems a bit complex as an opener. Having dived into big-O notation, the next chapter introduces the concept of arrays as implemented in JavaScript. A chapter on linked lists is next, with examples of setting up and using singly, doubly and circular linked lists. Stacks and queues each get a chapter. The chapter on stacks considers the runtime performance of different stack operators - push, pop, peak and search, as does the chapter on queues for enqueue, dequeue and peek. As with other chapters, there are examples of how to implement and use the structures in JavaScript code.
Most of the rest of Part 1 of the book is a series of chapters about different types of trees, from the basic tree through binary trees, binary search trees, heaps and prefix trees. There are also chapters on hashtables and graphs, which you may think of as specific types of tree structures depending on your viewpoint. Part 2 moves on to algorithms, and again Chinnathambi shows an interesting way of thinking by starting with an introduction to recursion. This is introduced as a technique that allows developers to break down large, complicated problems into smaller, more manageable pieces, with the advantage of helping improve logical thinking and problem solving skills. Basic recursion is followed by a chapter on Fibonacci and going beyond recursion. Other chapters in this part of the book examine well known algorithms including Towers of Hanoi, linear search, binary search, depth and breadth first searches. Interestingly, Quicksort comes before bubble sort in the list of chapters, and is followed by insertion sort, selection sort and merge sort. Overall, I enjoyed this book. The author writes well and keeps the material interesting with good examples. I didn't agree with all his decisions about how and when to introduce topics, but anybody reading the book would gain a useful overview of some of the key algorithms and their usefulness. To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
|