fbpx
Coding Basics

Algorithms Every Programmer Should Know

#1 Sort Algorithms

Sorting is the one of most heavily studies concepts in Computer Science. Idea is to arrange the items of a list in a specific order. A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of element in the respective data structure. Though every major programming language has built-in sorting libraries, it comes in handy if you know how they work.

Merge Sort, Quick Sort, Bucket Sort, Heap Sort, Counting Sort, Insertion Sort.

#2 Search Algorithms

This is another important category of algorithms which are essential for many real-world applications. Searching Algorithms are designed to check for an element or retrieve an element from any data structure where it is stored. Based on the type of search operation,  There is fewer algorithms here, compare to sorting ones.

Linear Search: Depth First Search(DFS)

Binary Search: Breadth First Search(BFS)

#3 Hashing

Hash lookup is currently the most widely used technique to find appropriate data by key or ID. Hashing is an important Data Structure which is designed to use a special function called the Hash function which is used to map a given value with a particular key for faster access of elements. The efficiency of mapping depends of the efficiency of the hash function used. We access data by it’s index.

Hash Map, Hash Table, Dictionary.  

#4 Dynamic Programming

Dynamic Programming (DP) is a method for solving a complex problem by breaking it down into simpler sub problems. Dynamic Programming is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for same inputs, we can optimize it using Dynamic Programming. We solve the sub problems, remember their results and using them we make our way to solve the complex problem, quickly.

Duckworth-Lewis method Floyd’s All-Pairs shortest path algorithm.

#5 String Matching & Parsing 

Pattern matching/searching is one of the most important problem in Computer Science. Since the strings being parsed are relatively simple and the data follows a general format, searching for common patterns seems to be the easiest approach to this problem.  There have been a lit of research on the topic.

KMP Algorithm (String Matching)

Regular Expression (String Parsing)

Share This Post To Your Friends

Similar Posts

Leave a Reply

Your email address will not be published.