File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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).
I agree. Here's the link:
subject: Algorithm Analysis Question
Why & how to build map of maps?
most efficient way to remove duplicates from list?
Comparison of ArrayList and HashMap
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014