Start you Sort & Search algorithm journey here
Why bother to understand Sorting and Searching algorithms? There built-in library functions to take care of that, right?
Sorting and Searching are easy problems to understand and is a great way to be introduced to computational complexity. This is the best way to start with deeper understanding of the problems you can solve with your computer.
Also, Sorting and Searching is a key in most programs today. There are many different sorting algorithms, which should be used in specific scenarios. This is fundamental if you want to deliver a high quality program to the end user.
It is a fundamental building block for any professional software developer to master the basis of Sort and Search algorithm.
Step 1: The fundamental sorting algorithm
You need to start with the most basic sorting algorithm to understand the problem.
This tutorial will get you started. Understand why the naive way of sorting (Selection sort), is not optimal for most cases.
The tutorial has a video that will walk your through how the algorithm works, also it contains the full code of Selection sort.
Step 2: Insertion sort
Now you know the basic algorithm is not considered efficient. You also know, that Selection sort does have advantage, it does not use auxiliary space.
The next algorithm to consider is Insertion sort. It is also not performing good in the normal use-case. But it can keep a sorted list at all times, where you can insert new elements and still keep the list sorted. This makes Insertion sort worth to understand.
This tutorial has a video to explain it to you along with how to code it.
Step 3: Merge sort
Merge sort is another amazing algorithm. It is efficient and uses the concept of recursively breaking down the problem to smaller problems.
The concept of breaking a list down to smaller lists is a great learning, as it is a way to master many computational problems. This technique is cornerstone for any software developer.
This tutorial has a video explaining Merge sort. Also, you will get all the code.
Step 4: Bubble sort and time complexity
Now we understand how we can make efficient sorting. Bubble sort is a special algorithm, because it is not efficient, so why bother learning it?
Well, Bubble sort can check if a list is sorted efficiently. And if the list is almost sorted, it is efficient.
Hence, this algorithm is good to use in cases where you have data that is close to be sorted and run it on that.
This tutorial also has a video to walk you through the algorithm. Then it will have the code and we do some performance testing on it.
Step 5: Binary search
Now it is time for all the sorting to pay off. When you have a sorted list you can find elements efficiently.
This is also a key thing to master as a software developer. You need to understand Binary search, as it is a key principle to master in your toolbox.
This tutorial has a video explaining Binary search and the code how to do it.
Step 6: A Heap
A Heap is a concept you will encounter at some point with sorting and searching. A Heap is a nice way to keep data in an efficient way to get the maximum element at all times. This means it is built in a way where you can insert elements at any time, but still take the maximum element whenever you feel like it.
A Heap is a beautiful creation and also one of the things you want to understand. The Heap can be represented in many ways. In this tutorial we will keep it as a Binary Tree.
A natural next step is to get a bit deeper into the theory and learn it in a more structured way. Check out the the online course on the subject.