Uploaded by rukshan ruwandika

bigOnotation

advertisement
Dry Run
A dry run is used to check an algorithm during program design. Dry run testing is a static test and should
be performed by the software developer to relieve the impacts of a failure of the product and meaning
before the end-user gets the final result and finds and discovers it doesn't do what it says it will. In dry
run testing, no hardware is used and but it is assumed that the software engineer who is testing the
code is aware of what each line of code is supposed to do and gives him the opportunity to make
corrections to the code before it becomes an issue for the actual software. A dry run test comprises
programmers manually reading their code line by line to find errors and fix these errors. This is a simple
Visual Basic code page and a full software application code page would look much more involved.
Big O Notation
Big O notation is a convenient way to find how fast a function is growing. When understanding the time
complexity T(n) of an algorithm it’s rarely meaningful, or even possible, to compute an exact result.
Usually, we are only interested in how fast T(n) is growing as a function of the input size n.
An example, if an algorithm increments each number in a list of length n, “This algorithm runs in O(n)
time and performs O(1) work for each element” we might say.
Efficiency of algorithms


Computational resources: time and space
Best, worst, and average-case performance
Best, worst, and average-case Linear search,



Best Case - The item we search for is in the first position, examines one position
Worst Case - item not in the array or in the last position, examines all positions
Average performance (given that the item is in the array) examines half of the array
Binary search



Best case - item in the middle, one check
Worst case - item in the last possible division; the maximal number of times an array of length N
can be divided is log2 N
Average case- item is found after performing half of the possible number of divisions; ½ log2 N
Fibonacci number series Python code
Download