Learning the fundamentals of sorting and path finding algorithms
Because of the app SoloLearn I was introduced to some sorting algorithms like bubble sort or shell sort but I never really dived into this topic.
A cooking recipe is also just a series of steps to achieve a logical result, which is to bake the exact cake with as few steps as possible. Imagine if someone wrote something like “… and then add 250 grams of flour…. no, wait, it’s actually 100 grams… never mind, put in as much flour as you need until the dough looks good…”. You would be confused and as a result, this algorithm of yours would go horribly wrong when baking a cake.
Before diving into various sorting algorithms, it occurred to me that search algorithms are also an important topic to cover.
In the next steps I would go along learn about different sorting algorithms and code them with the programming language python.
The three main path finding algorithms that nearly every thread on the web recommended were Depth First Search, Breadth First Search and Dijkstra’s algorithm. There are two major things that you have to consider here.
Underneath each algorithm you can find the according animation how this algorithm looks like when put into a maze to search for a goal. (The third animation shows the difference between all of them, keep in mind that Dikstra is weighted)
Evaluating the performance of a given algorithm is crucial when it comes to writing a good algorithm. The main question you ask here is: “How does the time and capacity of the working memory (RAM) grow when the input size grows towards infinity?”
These problems are often asked in job interviews when you want to apply for a programming job. Unfortunately, these problems have nothing to do with the actual work you will be doing later, because no one is asking you to write a sorting algorithm from scratch. People use precoded modules for these tasks in order to focus on the actual work.
Problems that you can find in most computer science textbooks are pretty straight forward with an easy to understand goal. But what about more abstract real life situations? For instance it’s your task to boost a performance of a system.
I never seen two pretty best friends but if I have to choose one pair it would be algorithms and data structures. Simply put, data structures are just different ways to store your data. Whether you store the data in a hierarchy (e.g. in a min-max heap) or with a key + value pair (Hash table), the main task remains the same… storing data.
Problem solving is the backbone of computer science, and algorithms are just step-by-step instructions on how to solve them using a language that a computer can understand. So knowing how an algorithm works is critical if you want to understand more sophisticated algorithms like machine learning algorithms.
What’s kind of frustrating is that you usually don’t need to know how to program a sorting algorithm like Quick Sort from scratch because they either come in packaged modules that you can install, or you can find the code on stackoverflow.com But getting comfortable with a real programming environment wasn’t my goal. My primary goal was to understand the code and evaluate its performance.
At the end I must say learning about fundamental algorithms has helped me immensely to think in a more structured way when approaching logical problems which I’m quite thankful for.