DEV Community

Saoni Deb
Saoni Deb

Posted on

Why do you need to learn and understand Algorithms?

Learning is a bit daunting when books don't explain why are you learning this particular thing.
In my early years I had been fortunate to have teachers who actually took out time to feed that curiosity, and explain why we were learning anything.
Be it calculus (which we use in reality to calculate how infinitesimal small force--additive or otherwise, can impact anything) or statistic which we need to visualize details about customers in real life.
If you can visualize one real time use case, learning becomes easier, it makes us feel that us learning something would actually help us contribute towards something in future.
Let's move towards algorithms now, specifically arrays today.
We know arrays are used to store contiguous memory but why do need the related algorithms?
Few of the must needed algorithms that you must have come across are --

  1. Kadane's algorithm
  2. Linear Search
  3. Binary Search
  4. Dutch National Flag
  5. Prefix and Suffix sum
  6. Sliding Window
  7. Two Pointer Technique
  8. Precomputation Covering corner cases, and the other types of arrays like sparse, jagged, 2D, frequency, etc are also needed. in our day to day solutions. We will start with where Kadane's algorithm is used in real life - its applications include buying and selling stocks, in genomic sequences analysis, as well as image processing etc. The intuition behind it is to find the maximum sum of a contiguous subarray in an array. It gives us an optimal solution in O(n) therefore it is one of the most efficient algorithms. Below are few of the questions that can be solved using Kadane's algorithm :

Top comments (0)