http://qs321.pair.com?node_id=227926


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 = ?