Definition: An algorithm is a clearly specified set of simple instructions to be followed to solve a problem.
- Once an algorithm is given for a problem and decided to be correct, an important step is to determine how much in the way resources, such as time or space (memory) the algorithm will require.
- Algorithm analysis is an important part of a broader computational complexity theory, which provides theoretical estimates for the resources needed by any algorithm which solves a given computational problem. These estimates provide an insight into reasonable directions of search for efficient algorithms.
Running Time of a Programme
The running time of a program depends on factors like,
- The input to the program (size and characteristic nature)
- The quality of code generated by the compiler
- The nature and speed of the instructions on the machine used to execute the program
- The time complexity of the algorithm underlying the program
Reasons to analyse Algorithm
Main reason is for discovering its characteristics for evaluating its suitability with less performance bugs and compare it with other algorithms. Analysing is to be able to accurately predict the performance characteristics of particular algorithms when run on particular computers.
- Predict performance.
- Compare algorithms.
- Provide guarantees.
- Understand theoretical basis
We really can use the scientific method to understand the performance of algorithms in operation. As we know Scientists use the scientific method to search for cause and effect relationships in nature. Maybe we’re not unlocking new secrets of the universe but, we can use the, scientific method, and treat the computer, as something to be studied in that way and come to an understanding of how our program are going to perform.
These are the main steps in Scientific Method,
- Observe some feature of the natural world.
- Hypothesize a model that is consistent with the observations.
- Predict events using the hypothesis.
- Verify the predictions by making further observations.
- Validate by repeating until the hypothesis and observations agree
These are the Principles in Scientific Method,
- Experiments must be reproducible.
- Hypotheses must be falsifiable
So it’s framework for predictin