Last updated : Jul 05, 2021
Learning algorithms and data structures is an important part while you are starting programming career. Whether you want a job in software giants like Microsoft, Google or you want to do competitive programming or you just want to polish your programming and thinking skills, this is the article you need
The answer to this query is learning about algorithms.
Now what actually an algorithm is:
Algorithm is a set of instructions which solves a specific problem in finite number of steps. For eg: if you want to add two numbers then the algorithm would go like this:
input 2 numbers
add 2 numbers
finally print the result
And that's it. Is that an algorithm? You may be confused because you all have been adding numbers since the starting of your programming studies. But none cares about how simple problems such as adding, multiplying numbers can be an example of algorithms. But if you go way back in centuries when there were few people who were literate. In India those people were the sages who actually defined these instructions in steps to solve many problems by hand which we do with machines like calculator. Isn't that interesting that we Indians knew how to solve problems with algorithms much before than the world did.
But we are here to know how algorithms can help you shape your career in programming.
After knowing that what an algorithm is now it's time to know some more things about algorithm:
Data Structues
Types of problems (faced by programmers while solving a problem)
Time and space problems
Types of algorithms
Applications of algorithms
Data Structures
Just like an algorithm is a way of solving any problem, in the same way while solving a problem you need memory to store your data on which an algorithm processes.
If you are a beginner programmer and you want to learn problem solving then you need to master following data structures:
Array
Linked List
Binary Tree
Hash Map
Graph
Types of problems (common while programming)
String processing
Searching
Combination problem
Graph problems such as (Travelling salesman problem)
Time and space problems
You have to create algorithm that is appropriately using space(memory) and completes it's process within a limited duration of time.
Let me give you an example:
If you have to take 10 people from one place to other in 2 seater car then it will take 10 rounds to complete task because only one can sit beside the driver. Here you have less space that's why it is time consuming.
Another version of the above example can be stated as now your are given a 10 seater bus so now you can complete the task in one go. Because you have more space now.
So these 2 elements are important and need to be taken into consideration while creating any algorithm or if you are studying someone else''s then you need to test it on the basis of both time and space.
Types of algorithms
Now here I will tell you algorithms which you can practice and implement with a running script.
Algorithms you should know while programming:
Recursive algorithms
Dynamic programming algorithm
Backtracking algorithm
Divide and conquer algorithm
Greedy algorithm
Brute force algorithm
Applications of algorithms
Genetic algorithm used in identifying genes and their numerous functions
Map applications includes graph domain
Backtracking algorithm is used moslty in probabilistic problems and decision making
Sign in for comment. Sign in