Ravi Ojha

Author
Ravi Ojha

Blogs
Ravi began their journey in software development but found their voice in storytelling. Now, Ravi simplifies complex tech concepts through engaging narratives that resonate with both engineers and hiring managers.
author’s Articles

Insights & Stories by Ravi Ojha

Explore Ravi Ojha’s blogs for thoughtful breakdowns of tech hiring, development culture, and the softer skills that build stronger engineering teams.
Clear all
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Filter
Filter

Top 7 algorithms and data structures every programmer should know about

Coming from the background of Competitive Programming and Software Development, I have compiled a list of algorithms and data structures that every programmer should know about. We will see what they do and where they are used with simple examples. This list is prepared to keep in mind their use in competitive programming and current development practices.

Here are the Top 7 algorithms and data structures to know:

  1. Sort Algorithms
  2. Sorting is the most heavily studied concept in Computer Science. Idea is to arrange the items of a list in a specific order. Though every major programming language has built-in sorting libraries, it comes in handy if you know how they work. Depending on the requirement, you may want to use any of these.

    More importantly, you should know when and where to use them.

    • Sorting by price, popularity, etc. in e-commerce websites
    • Sorting by score in HackerEarth contest leaderboard

  3. Search Algorithms
  4. Binary Search is used to perform a very efficient search on sorted datasets. The time complexity is O(log N). The idea is to repeatedly divide in half the portion of the list that could contain the item until we narrow it down to one possible item.

    • Searching for a song in a sorted list
    • Git debugging via git bisect

    Depth/Breadth First Search are also commonly used in tree/graph data structures.

    • Used by search engines for web-crawling
    • Used in AI to build bots
    • Finding shortest paths on maps

  5. Hashing
  6. Hashing is the most widely used technique to find appropriate data by key or ID. The data structure is referred to as a Hash-Map or Hash-Table or Dictionary.

    • Routers use IP address → Path mapping
    • Checking for duplicates efficiently

  7. Dynamic Programming
  8. Dynamic Programming (DP) solves problems by breaking them into simpler subproblems and storing their results to save time.

    This analogy explains DP like a 4-year-old could understand it.

    • Used in many DP algorithms
    • Real-world example: Duckworth-Lewis method in cricket

  9. Exponentiation by Squaring
  10. Instead of looping N times, Exponentiation by Squaring calculates powers in O(log N). This method is commonly known as Binary Exponentiation.

    • Used in RSA encryption

  11. String Matching and Parsing
  12. Pattern matching and validation are widely used tasks. For example:

    • KMP Algorithm is used for matching substrings
    • Regular expressions for validation and parsing input

  13. Primality Testing Algorithms
  14. To test whether a number is prime, we use:

    • Sieve of Eratosthenes – for finding primes in a range
    • Trial Division up to sqrt(n) – when memory is limited
    • Fermat and Miller-Rabin Tests – probabilistic checks

    Applications:

    • Used in encryption (e.g., RSA)
    • Hashing algorithms

We'll discuss some advanced algorithms every competitive programmer should know in the next post. Meanwhile, master the above or comment what you think every beginner-intermediate programmer should know.

Till next time. Evíva!