Algorithms: Insertion Sort

Welcome to the first post on Software Engineering 101, where I aim to post weekly(ish) deep-dive articles on algorithms, design patterns, data structures and more! This week we’ll be taking a look at the Insertion Sort algorithm. Insertion Sort is an algorithm used to sort a given list of items. It does so by iterating through the list and building the sorted output one item at a time. Upon each iteration, an item is taken from the list and inserted into the correct position by comparison with its neighbours. This process is repeated until we reach the last item and there are no more left to be sorted. Insertion Sort Let’s begin by taking a look at some of it’s advantages: It’s a simple algorithm to implement Performance is very high when operating with small lists Even more so when the list is already mostly sorted, as fewer iterations of the sorting logic need to take place However, the algorithm

read more Algorithms: Insertion Sort