Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis


Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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 �***
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
"aaaaa aaaaa"
Please don't post the same message in multiple forums. It makes a conversation difficult to follow.

Also, please adjust your display name to match the Naming Policy (basically it should be a legit first and last name).

Lastly -- I'm moving this to the Performance forum, where I think this is a better fit. Please post your replies here.

Thanks! And welcome to the JavaRanch!
    Bookmark Topic Watch Topic
  • New Topic