Posts

Showing posts with the label worst case

Types of Algorithms analysis

To analyse the given algorithm we need to know on which inputs the algorithm will takes less time and long time. We have already seen that an algorithm can be represented in the form of an expression.  That means we represent the algorithm with multiple expressions: one of the case where it takes less time and other for the case where it takes the more time. In general the first case is called the ‘Best Case’ and second case is called the ‘Worst Case’ of the algorithm. To analyse an algorithm we need some kind of syntax and that forms the base for asymptotic analysis/notation. There are three types of analysis: Worst Case: Defines the input for which the algorithm takes long time. Input is the one for which the algorithm runs the slower. Best Case: Defines the input for which the algorithm takes lowest time. Input is the one for which the algorithm runs the fastest. Average Case: Provides a prediction about the running time of the algorithm. Assumes that the