Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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
Replies are listed 'Best First'.
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 meditating upon the Monastery: (7)
As of 2015-08-01 18:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found
    past polls