Before we start learning why it’s important to learn data structures and algorithms, it’s really important to know what an algorithm is.
An algorithm in simple terms is a series of steps to solve a problem and get the desired result. This is usually how most algorithms work: input->function(algorithms/steps)-> output.
A great example of a simple algorithm is to make a fibonacci series. A fibonacci series is found by adding up two of the previous numbers. Below is the algorithm or function used to spit out the output.
def fib(n): a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a+b print() fib(100)
Here the algorithm goes up 100. Like 0,1,2,3,4,5, etc .and it prints 0 1 1 2 3 5 8 13 21 34 55 89.
Data structures are used to store data and algorithms are used to solve problems using the data.
Data structures and algorithms are important because they give us an idea of how to make our algorithms and data simpler and cleaner. This also gives us an idea of the science and the efficiency of the algorithm.
When writing algorithms it is important to save time. This is really important because saving time not only saves time but also increases the scalability of the algorithm. When you have operations that grow exponential it's easy for the computer to start showing signs of slowing down.
What makes a good programmer from a great programmer is knowing these little things that can make a huge difference.