Posted: February 1st, 2023

# Checking the correctness of an algorithm

Ways to express solution algorithm
There are numerous ways to express the algorithm which provides a solution to given problem; it can be expressed as flowchart, pseudo code, natural language, programming language or drakon-chart. Natural language is used to make an algorithm easy to understand but while solving complex problems it may create ambiguity and becomes a lengthy procedure. Programmers usually recommend flowcharts, pseudo codes or drakon-charts to express algorithm as these methods provide structured way and high-level description. Every solution algorithm must provide detailed implementation description that includes problem statement, list of entities used, logic and other resources to be used.

Checking the correctness of an algorithm
Solution algorithm is declared to be correct based on functional and specification correctness; functional correctness identifies the working of input and the expected output. Specification based correctness checks the overall behavior of the algorithm based on the system in which it is going to be implemented. Algorithm must be checked for total correctness that means it produces the correct results for the given inputs and it gets terminated precisely. Checking of solution algorithm depends on the correctness of statements to be proven, the assumptions and the reasoning logic. The expected output of any algorithm is based on the series of instructions, the given inputs and the state or behavior of variables used in the algorithm. Usually most of the computations are based on mathematical expressions while solving a problem so induction method can be used as an efficient tool to prove the correctness of solution algorithm. Mathematical induction works well where loops, iterations or recursions are used to solve a problem

Don't use plagiarized sources. Get Your Custom Essay on
Checking the correctness of an algorithm
Just from \$13/Page

Generic or specific solution
Algorithm must be checked whether it provides a generic solution or a specific solution; that means the solution algorithm can give exact specific solution to the given problem or it results in simple general solution. For example, an algorithm is written for calculating the area of circle by giving radius values; it is then identified that the algorithm can calculate the area of circle by giving all range of radius values as input or just particular values. If the solution algorithm provides exact results for all range of values, it means it is correct otherwise it is reviewed. Formal semantics and set of rules defined are also identified while checking the correctness of solution algorithm. Semantics defines the meaning of technical specifications and the inference rules represents that the logic of the algorithm works correctly. Validation of semantics is being carried out in this stage to determine the feasibility of the solution algorithm with programming language code.

Posted: February 1st, 2023

# Checking the correctness of an algorithm

Solution algorithm is declared to be correct based on functional and specification correctness; functional correctness identifies the working of input and the expected output. Specification based correctness checks the overall behavior of the algorithm based on the system in which it is going to be implemented. Algorithm must be checked for total correctness that means it produces the correct results for the given inputs and it gets terminated precisely. Checking of solution algorithm depends on the correctness of statements to be proven, the assumptions and the reasoning logic. The expected output of any algorithm is based on the series of instructions, the given inputs and the state or behavior of variables used in the algorithm. Usually most of the computations are based on mathematical expressions while solving a problem so induction method can be used as an efficient tool to prove the correctness of solution algorithm.

Generic or specific solution
Algorithm must be checked whether it provides a generic solution or a specific solution; that means the solution algorithm can give exact specific solution to the given problem or it results in simple general solution. For example, an algorithm is written for calculating the area of circle by giving radius values; it is then identified that the algorithm can calculate the area of circle by giving all range of radius values as input or just particular values. If the solution algorithm provides exact results for all range of values, it means it is correct otherwise it is reviewed. Formal semantics and set of rules defined are also identified while checking the correctness of solution algorithm. Semantics defines the meaning of technical specifications and the inference rules represents that the logic of the algorithm works correctly. Validation of semantics is being carried out in this stage to determine the feasibility of the solution algorithm with programming language code.

Don't use plagiarized sources. Get Your Custom Essay on
Checking the correctness of an algorithm
Just from \$13/Page

### Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

## Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
\$0.00
Need assignment help? You can contact our live agent via WhatsApp using +1 718 717 2861

Feel free to ask questions, clarifications, or discounts available when placing an order.