Link to home
Start Free TrialLog in
Avatar of yattias
yattias

asked on

Big O Notation

This question is not very difficult but it is urgent and I do need a good explanation for it.

Can anyone tell me how to calculate big O notations of algorithms ?(I am not providing you with one because I dont have one specific in mind), especially while, for or any other iterated loops.  Can you please be descriptive because I need to really know this for my final exam and its very urgent.  Can you tell me how to calculate it for various cases and show me what algorithm will give O(nlog(n)).  Please help
Avatar of Mayank S
Mayank S
Flag of India image

This is not essentially a Java question, it might be better answered in the Programming TA.
For example:

for ( int i = 0 ; i < n ; i ++ ) // a loop which runs n times
  for ( int j = 0 ; j < n ; j ++ ) // a loop which runs n times each time the outer loop runs (which is also n times)

Hence the above has an order of n-square.
This has some explanation for computing it for sorting algorithms:

http://www.ics.uci.edu/~eppstein/161/960116.html
Avatar of avinthm
avinthm

ASKER CERTIFIED SOLUTION
Avatar of amol_chaudhari
amol_chaudhari

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial