Introduction to Algorithm
In this topic, we have discussed the introduction To Algorithm which represents the way to solve any problem. It is very important to understand how a common man applying the algorithm everywhere to complete any work in day to day life it’s very common and it’s very compulsory as well to complete the work effectively. Suppose a farmer selling crop in the market and earn some money there will be many cases occurs where the farmer will think about the best approach with a huge profit.
Farmer will check market price, Size of market, demand supply, and farmer will also think how to sell the crop either per Kg or per quintal to make more profit here the farmer is also applying some logic and algorithm to complete the work ineffective way to get more profit these ideas came from experience and challenges faced by the same or other farmers. In technical term, if we talk about any programming language without any algorithm it’s not possible to write any effective logic.
Before writing any logic in any programming language we should think about the below things.
- The correctness of the program: In any conditions, your output should be correct before applying any algorithm make sure your output is cent percent correct otherwise there is no meaning of algorithm or your program.
- Time: Time is very important everywhere you must have to take care of how much time your algorithm is taking to complete the work.
- Complexity: How much your algorithm is complicated in term of logic, the time is taken and memory used to complete the work?
Components of Algorithm
As we have discussed earlier in an introduction to algorithms that it has different components, which differs from each other in different situations. Generally, algorithms comprise four components:
1. Input or feedback
As we know algorithms are sequences of steps to be followed to get some output we need to provide some inputs to an algorithm one good example from daily life is when we need sugar as output we have to give sugarcane as input. These days, smartphones are coming with a face lock where you have to come in front of the camera and your face will be taken as input and the algorithm will judge your face by using your face cut, wrinkles, Hairs, and different parameters, then compares with stored face, which was given first time to mobile.
2. A sequence of Algorithms
After having inputs and introduction to algorithms then the next step to follow is the sequencing of steps present in the algorithm according to what output we want we have to arrange steps present in the algorithm.
4.6 (3,144 ratings)
View Course
- Condition:
Sometimes we have to check condition, according to input as example IRCTC(Indian railway ticket booking app) checks if a person is eligible for a discount on the basis of age by using the Age as input algorithm checks if the person is above 65 or not. If a person is above 65 then he will be eligible for a discount Otherwise, not.
- Repetition:
Sometimes there are steps, which we have to repeat until reaches of desired outputs. Example, if I want to search a record in files then we have to compare our input with different files until we find out our desired output in this case same steps are repeated till the output(Files).
Applications of Algorithm
If an employee is coming from the office he will think to reach home as soon as possible and he will try to take the shortest path to cover the distance.
Below is some very important use case where the algorithm has been used.
- If you are searching for any item on any shopping site next time you will get a similar type of item as a suggestion.
- If you are watching any video on YouTube next time you will get similar type suggestions as recommended video for you.
- Have you thought about how Google search engine works and why within seconds results appear?
- In the same way, if we used Facebook we will get the friends suggestions on the basis of some keys like School Name, College Name, and Places etc.
Recommender system
Nowadays it is very common in our day to day life everywhere recommender system is working directly or indirectly according to the activities and it is very beneficial for both provider and user. Example: If you are searching for any shoes on Amazon and next time you will get recommendations of similar type of shoes as suggestions it will very easy for you to select item and for the Amazon as well there is a very good chance that you can by shoes and on the basis of user’s data recommender system work and behind this recommender system machine learning algorithm works.
Characteristics of Algorithm
Below are the characteristics of Introduction To algorithm
- Finiteness: Any algorithm should complete at one particular time and this is very important for any algorithm otherwise your algorithm will go in infinite state and it will not complete ever.
- Definiteness: Each algorithm should be clear and unambiguous.
- Effectiveness: Each line of an algorithm should be essentials. We should try to write in a simple way so it would be basic.
- Input: Every algorithm should take input it can be Zero or one or more. So according to the conditions user can use.
- Output: For any work some output should come, this is must otherwise there is no meaning of any work. In the same way, each algorithm should generate one or more output.
- Generality: The algorithm should be common for the set of input and requirements so the same algorithm can apply in multiple places according to the user’s requirements.
Advantages and Disadvantage of Algorithms
Below are the advantages and disadvantages:
Advantages
In this topic of Introduction To Algorithms, we also show you the various advantage of using algorithms some of them are listed below:
- The algorithms are very easy to understand and can be written in simple language which can be understood by anyone
- Algorithms can be broken down into different pieces, which will be easy to implement practically.
- By using algorithms, we can easily understand the sequence to be followed in processing.
Disadvantages
Below are some main disadvantages of any algorithms:
- It’s very difficult to convert the complex task into proper algorithms.
- Its time-consuming process because we need to spend proper time for writing algorithm and later we need to implement in a programming language.
- It’s complicated to show functionalities for each step of introduction to algorithms and it’s hard to understand each flow in the term for loop and branch.
Recommended Articles
This has been a guide to Introduction to Algorithm. Here we have discuss Introduction to Algorithm with the basic Points and Characteristics. You may also look at the following articles: