Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: An informal introduction to O(N) notation

by BUU (Prior)
on Jan 18, 2003 at 05:26 UTC ( [id://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?

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://227926]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-03-28 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found