Algorithm Summary
Algorithm Summary
CIT-227-018/2023
CSE 2112
1. DISCUSS ALGORITHM IN PROGRAMMING
An algorithm is a set of well-defined instructions that outline the step-by-step
systemic procedure in a finite number of steps to get the solution to a problem,
get the answer to a query or perform a given task. It is a series of logical and
mathematical operations that convert input data into output results.
Input- The data or information an algorithm receives to work with.
Control Structures- Allow the algorithm to make decisions and control the flow of
execution based on certain conditions. They include loops, if-else and switch case
statements.
Output-The final result the algorithm produces after processing the input.
Qualities of a good Algorithm:
a) Efficiency- It ought to perform its tasks fast with minimal use of resources.
b) Correctness must produce accurate outputs for all valid inputs.
c) Clarity- It should be easy to understand to maintain and modify it.
d) Reliability- It should always supply accurate results under different conditions.
e) Adaptability- It can be applied to a range of related problems with minimal
changes.
Types of Algorithms:
a) Brute force Algorithms- Exhaustively tries all probable solutions suitable for
small problem instances.
b) Backtracking Algorithms- Explores capable solutions by means of undoing
alternatives that lead to wrong final outcome.
c) Searching Algorithms- Used to look for a specific target, thus efficient retrieval
of information.
d) Sorting Algorithms- Arrange elements in a unique order to enhance data
organization and retrieval.
e) Encryption Algorithms- They convert information into secure and unreadable
form by use of cryptographic techniques ensuring privacy in virtual
communications and transactions.
Factors to consider when designing an algorithm:
a) Maintainability- It must be designed in a structured way so that during the
redefinition of the algorithm no major modifications are made to the original.
b) Functionality- It is able to solve the problem it was designed for.
c) Robustness- This refers to the algorithm’s capability to define the problems
clearly.
d) User-Friendliness- If it is far clattered it is going to slow it down.
e) Extensibility- It is able to be modified and its functions extended.
Complexity of an algorithm:
It is a way of measuring the algorithm’s overall performance
a) Time Complexity- It is the amount of time required to complete an algorithm’s
execution. The big O notation is used to symbolize this.
b) Space Complexity- Amount of memory an algorithm calls for to solve a problem
and produce an output.
Algorithms play an important role in software development enabling developers
to create optimized solutions for problems. Algorithms play an important role in
1.AI to assist in decision making
2. Data science in the field of machine learning.
Software testing is necessary for the delivery of high-quality products to the end
user.