Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: An informal introduction to O(N) notation

by BUU (Prior)
on Jan 18, 2003 at 05:26 UTC ( #227926=note: print w/ replies, xml ) Need Help??


in reply to An informal introduction to O(N) notation


O(N2) says that the algorithm's performance is proportional to the square of the data set size. This happens when the algorithm processes each element of a set, and that processing requires another pass through the set. The infamous Bubble Sort is O(N2).
Shouldn't bubble sort be O(NN) as you might have to process the entire thing once for each element, if it was sorted backwords for example?


Comment on Re: An informal introduction to O(N) notation
Re: Re: An informal introduction to O(N) notation
by jryan (Vicar) on Jan 18, 2003 at 09:38 UTC
    So, thats one sort for each element in an n sized list... and if each sort is O(n) for one member, then n*n = ?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://227926]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-08-01 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (8 votes), past polls