Steps in the development of algorithm
Steps involved are
1. Statement of the problem
2. Design of an algorithm
3. Correctness of the algorithm (validation)
4. Analysis of complexity of the algorithm (Mathematical and Empirical
model)
5. Implementation
6. Program testing (verification)
7. Documentation
1. Statement of the problem
First create a formal model of the problem to be solved. The model is
created by
• Talking to the users to assess their needs
• Understanding the complete problem to be solved
• Making a formal representation of the system being designed
Before create & defining the problem, ask:
• Do I understand the statement of the problem
• What data is available?
• What data do I want to find out?
• How would I recognize a solution?
• What assumptions have been made?
• What formulas are needed?
• What relationships exist among data values?
• What determines a complete solution?
2. Design of the algorithm
Creating an algorithm is an art which may never be fully automated. There
are various algorithmic design techniques (Divide and Conquer,
Backtracking, Branch and Bound, Dynamic Programming and Greedy) have
often yielded good algorithm. By mastering these strategies, it will become
easier for you to devise new and useful algorithms.
Choice of a design technique, which often highly independent of the choice
of the model can often greatly influence the effectiveness of a solution
algorithm. Sometimes two different algorithms may be correct.
3. Correctness of the algorithm (Validation):
Trace out the algorithm on a variety of test cases
• choose 2 or 3 simple test cases which are valid
• Establish what the expected results should be
• Make a table of the relevant variable names within the algorithm • Walk
the first test case through the algorithm. keeping a record of the contents
of each variable in the table as the data passes through the logic
• Repeat the walk through process, using the other test data cases
• Check the expected results against the actual results
This is not a program proof.
4. Analysis of complexity of the algorithm:
Analysis: Measuring the amount of work done by an
algorithm. It involves:
1. Time complexity : time needed to execute the algorithm
2. Space complexity : space required to store the
algorithm
5. Implementation
Programmers use the specification to write the code necessary to write
the code necessary to fulfill all the requirements of the program. The
good programmer will consider
• What are the variables and their types used?
• How much memory is required?
• Data structures used?
• Objects and function borrowed
• What language to use?
• Future maintenance: any code that may be modified in future and
should be allowed for what writing the code
• Code reusability : this enables programmers to identify areas of quickly
and easily
6. Program testing and debugging
Virtually all programs have defect in them called “bugs” and these need
to be eliminated. Bugs can arise from errors in the logic of the
program specification or errors in the programming code created by a
programmer. Special programming tools assist the programmer in finding
and correcting bugs. Some bugs are difficult to locate and fixing them.
Providing a mathematically rigorous proof of the correctness even for a
small problem is quite difficult. Therefore we resort to a process called
testing. We execute the program with data called the test data and the
program behavior with expected behavior. It is called program
verification.
Types of Testing
i) Black Box testing: Also called functional testing, whereby the internal
workings of the item being tested are not known by the tester. The
tester only knows the inputs and what the expected outcomes
should be and not how the program arrives at those outputs. The
tester not even examines the programming code and does not need
further knowledge of the program other than its specification.
ii) White Box Testing: It is a testing method in which the internal
structure, design and implementation of the item being tested is
known to the tester.
iii) Alpha Testing: It is like performing usability test, which is done by
the in-house developers who develop the software or tester.
Sometimes it is done by the client or an outsider with the presence
of developer and tester.
iv) Beta Testing: It is done by limited number of end users before
delivery, the change request would be fixed if the user gives
feedback or reports defect.
v) Gamma Testing: It is done when the software is ready for release
with specified requirement.
vi) Documentation: The completed software is packaged with full
documentation and delivered to the end user. Tools are available to
generate documentation. Different types of documentation are:
(1)Architecture/Design Documentation
(2)Technical documentation: Code, algorithm, interfaces (3)User
documentation: user manual, system administration support staff
manual
(4)Marketing documentation: Product briefs, promotional
collateral etc..