A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
Algorithm Analysis Question
Pavan Kumar Dittakavi
Joined: Feb 12, 2011
Mar 22, 2012 13:18:35
If I have a method which has two O(n) operations, then what would be Order of the method itself? Is it sill O(n)?
Joined: Mar 05, 2008
Mar 22, 2012 13:33:11
If the method just calls the two operations one after the other, then yes, the result is O(n).
If the method has loops or if statements, the result may be different. For example if it loops n times and calls one or more O(n) operations, the result is O(n^2).
It is sorta covered in the
JavaRanch Style Guide
subject: Algorithm Analysis Question
Why & how to build map of maps?
Comparison of ArrayList and HashMap
most efficient way to remove duplicates from list?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014