Mon Apr 11 2022 (3 months ago)
Engineer by mistake!
I am a software engineer by passion
A method or set of instructions that must be followed when performing problem-solving operations. As a result, an algorithm is a collection of instructions that govern how a work is to be conducted step-by-step to achieve the desired result termed as an algorithm.
Algorithms have a long history and the word can be traced back to the 9th century. At this time the Persian scientist, astronomer and mathematician Abdullah Muhammad bin Musa al-Khwarizmi, often cited as “The father of Algebra”, was indirectly responsible for the creation of the term “Algorithm”. In the 12th century, one of his books was translated into Latin, where his name was rendered in Latin as “Algorithmi”. But this was not the beginning of algorithms. Be curious about more…
Let's take a real-life example of making a cup of tea. There is a girl Sheha, who wants to make a cup of tea. To do so, she is following a series of steps.
She has to follow the below steps
Take a pan, fill it with water, and place it on the gas stove.
After the water has come to a boil, add the tea leaves and sugar.
Allow a full leaf expansion and milk after that.
Wait for the tea to come to a boil.
Turn off the gas after it has finished cooking.
You are set with your tea now :)
As you can see above, to make a simple cup of tea she has to follow certain steps. The collective terms of these steps are called algorithms.
As one would not follow any written instructions to cook the recipe, but only the standard one. Similarly, not all written instructions for programming is an algorithms. In order for some instructions to be an algorithm, it must have the following characteristics.
Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs.
Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well.
Clear and Unambiguous: The algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning.
Feasible: The algorithm must be simple, generic and practical, such that it can be executed with the available resources. It must not contain some future technology or anything.
Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.
Finite-ness: The algorithm must be finite, i.e. it should not end up in infinite loops or similar.
Below are the factors which should we consider while designing the algorithms.
Modularity: This feature was perfectly designed for the algorithm if you are given a problem and break it down into small-small modules or small-small steps, which is a basic definition of an algorithm.
Correctness: An algorithm's correctness is defined as when the given inputs produce the desired output, indicating that the algorithm was designed correctly. An algorithm's analysis has been completed correctly.
Maintainability: It means that the algorithm should be designed in a straightforward, structured way so that when you redefine the algorithm, no significant changes are made to the algorithm.
Functionality: It takes into account various logical steps to solve a real-world problem.
Robustness: Robustness refers to an algorithm's ability to define your problem clearly.
User-friendly: If the algorithm is difficult to understand, the designer will not explain it to the programmer.
Simplicity: If an algorithm is simple, it is simple to understand.
Extensibility: Your algorithm should be extensible if another algorithm designer or programmer wants to use it.
Once we think about the algorithm, there should be a way to represent it so that it can be delivered to others. No one is able to read what all algorithms are present in our minds. There are two standard ways of representing an Algorithm:
Flowcharts can be used to represent algorithms visually, they use diagrams that use particular symbols to show the flow of data, processing and input/output that takes place within a program or task.
Below is the flow chart that we have used to find the largest number among the two numbers...
Pseudocode is a form of Structured English for writing an algorithm. It uses programming-style constructs but is not written in an actual programming language. You do not need to worry about the detailed syntax or be precise about how the code will complete a particular task. Writing in pseudocode helps you concentrate on the logic (Process) and efficiency of your algorithm before you have to start thinking about the actual code you will be using.
Below is the Pseudocode that we have used to find the largest number among the two numbers...
READ n1,n2 IF n1>n2 WRITE "n1 is Maximum" ELSE WRITE "n2 is Maximum" ENDIF
The Human Genome Project has made great progress toward the goals of identifying all the 100,000 genes in human DNA, determining the sequences of the 3 billion chemical base pairs that make up human DNA, storing this information in databases, and developing tools for data analysis. Each of these steps requires sophisticated algorithms. Although the solutions to the various problems involved are beyond the scope of this book, many methods to solve these biological problems use ideas from several of the chapters in this book, thereby enabling scientists to accomplish tasks while using resources efficiently. The savings are in time, both human and machine, and in money, as more information can be extracted from laboratory techniques.
The Internet enables people all around the world to quickly access and retrieve
large amounts of information. With the aid of clever algorithms, sites on the Internet are able to manage and manipulate this large volume of data. Examples of problems that make essential use of algorithms include finding good routes on which the data will travel (techniques for solving such problems appear in and using a search engine to quickly find pages on which particular information resides.
Suppose computers were infinitely fast and computer memory was free. Would
you have any reason to study algorithms? The answer is yes if for no other reason than that you would still like to demonstrate that your solution method terminates and does so with the correct answer.
If computers were infinitely fast, any correct method for solving a problem
would do. You would probably want your implementation to be within the bounds
of good software engineering practice (for example, your implementation should
be well designed and documented), but you would most often use whichever
the method was the easiest to implement.
Of course, computers may be fast, but they are not infinitely fast. And memory
may be inexpensive, but it is not free. Computing time has therefore abounded
resource, and so is space in memory. You should use these resources wisely, and
algorithms that are efficient in terms of time or space will help you do so.
Proving the correctness of the algorithm is crucial. For many problems, algorithms are very complex. The reliability of an algorithm cannot be claimed unless and until it gives the correct output for each of the valid inputs.
In computer science, the analysis of algorithms is the process of finding the computational complexity of algorithms—the amount of time, storage, or other resources needed to execute them.
With all this, we came to the end of this article. We have seen the introduction of algorithms, it's the application, analysing an algorithm, etc. We saw can we represent an algorithm using flowcharts and pseudocode and implement them.
At the end, i would like to thank you for reading this article.
© 2021 dsabyte. All rights reserved