please tell me the concept regrading 1.time complexity 2.worst case 3.average case.
these term related to the processor or memory?
1. I don't really know I would guess at how much variation and how chaotic that variatin was
2. The worst case is the maximum resource used
3. The average case is the average resource used
For the processor this is normally in terms of processor time for memory it will be amount of memory used.
dear,
time complexity is related to processor, means how much time is taken by the processor to execute any program.max. time taken is worst case and average case is depending on the probability of occurance of particular item at a location.
In the analysis of algorithms, the bounds on the resources, i.e., time (related to processor) and space (related to memory) , are measured using asymtotic notations like Big-O, Omega etc. These are called time-complexity and space complexity respectively. Normally these are measued as a function of the input size.
Actually, these measures do not compute accurately how much time or space is used by a program. (These are not our concern either. Moreover, if we want we can measure this using a simple program.) In contrast, they tell us how the running time is growing as the input-size grows. For example, the time complexity of merge-sort is O(nlogn) while the time complexity of insertion sort is O(n^2). Having said this, we can say that the merge sort is much better than insertion sort. But we can not substitute the value of n in the formula and get the running time. The same applies to space complexity too.
The other questions have already been answered. Hope this helps.
Comment