Articles

Merge Sort Algorithm using recursion.

The merge sort is a very popular sorting algorithm. JavaScript comes with its own sorting function (sort()). However the sorting algorithms used by the various browsers are different from each other. So when you use sort() to sort an array with Mozilla firefox, firefox will automatically use the merge sort algorithm. Likewise, chrome uses a…

Recursion.

A recursive function is a function which calls itself. The program uses a particular function repeatedly to accomplish a specific task. But before we dive deep into recursive functions, it is important to understand the call-stack properly first. Call-stack: Consider, The above code is kind of like recursion. So what is going on here? The…

The Binary Search Algorithm.

The binary search algorithm is one of the fastest ways to find an element in a sorted array. Unlike linear/sequential search, the binary search does not compare the element being searched for with all the elements of the array. Fewer comparisons equals to more speed. Every JavaScript developer should have a knowledge about this algorithm.…

An introduction to computer algorithms and Big ‘O’

Why use Algorithms? That’s actually a good question. I know many developers who code without having any knowledge about algorithms or data structures. Some of these developers even end up at the top of the company hierarchy. Then why bother? Well if you simply want to be another developer, don’t bother to learn algorithms or…