How much does a program cost in terms of time? If we wanted to analyze the cost of a program, we have to figure out the cost each and every statement made in the application program. In your data structure and algorithms courses, you have to analyze the performance of algorithms to know how to construct efficient programs. In there, the main driving factor is the number of multiplications in an algorithm for example. Here, we have to analyze the cost of selecting one program over the other.
Consider the following algorithm to calculate the cost of a program.
The program is prepared to be opened as a file to be modified
Before and after every statement, put statements that read the time in milliseconds
Calculate the cost of the statement by subtracting the times off of each other
Output gathered statistics to application developer
Now, how can we do this with style? Using the JTextArea, we can output three columns as follows: line number �\t� cost in milliseconds �\t� the
Java statement; and the last row should output some global statistics. The application developer can then determine the statements that take intensive CPU cycles and begin to consider alternative coding approaches.
Can u replay to me as soon as u can �***