Tuesday, December 4, 2007

There is a trade off between machine time and space required

In any process, generally there is a trade off between the machine time and the space required i.e. the improvement of machine time effect the space and vice versa. Taking sorting particularly, the amount of machine time necessary for running the sorting program and the amount of space necessary for the program are the main efficiency considerations of the sorting.
If a file or a program is small, then sophisticated sorting techniques can be designed in order to minimize the amount of space. But this makes the time requirements usually worse or marginally betters in achieving efficiencies than that of the simpler techniques, but generally less efficient techniques. Similarly, if a particular sorting program is to be run only once then the machine time will be sufficient but the space in which the program is to run would be ludicrous .
It would be difficult for the programmer to spend days investigating the best methods of obtaining the last ounce of efficiency considering these considerations. However the programmer must be able to recognize the fact that a particular sort is inefficient and must be able to justify its use in a particular situation. Many times the designers and the planners are surprised at the inadequacy of their creation. To maximize the techniques and be cognizant of the advantages and disadvantages of each, so that when the need for a sort arises the programmer can supply the one, which is most appropriate for the particular situation. This brings the considerations to the time and space while designing the sorting techniques.
In most of the computer applications, the programmer must often optimize either time or the space at the expense of the other. While considering the time required to sort a file of size n, the actual time units are not concerned, as these will vary from one machine to another. Instead, the corresponding change in the amount of time required to sort a file induced by a change in file size n is the matter of interest. This shows the relationship between the time and the space. Let us consider y is proportional to x such that multiplying x by a constant multiplies y by the same constant. Thus if y is proportional ton x, doubling x will double y, and multiplying x by 10 multiply y by 10.
There are different ways to determine the time requirements of a sort, neither of which yields that are applicable to all the cases. One is to go through a sometimes intricate and involved mathematical analysis of the various cases, the result of which is often a formula giving the average time required for a particular sort as a function of file size that indicate the space required.
Considering these issues, it can be noticed that there is a trade off between the machine time and the space both of which contribute equally to the efficiency of the process like sorting.

No comments: