<?xml version="1.0" encoding="windows-1252"?>
<node id="227951" title="Re: Re: An informal introduction to O(N) notation" created="2003-01-18 06:07:47" updated="2005-07-07 15:09:45">
<type id="11">
note</type>
<author id="219414">
MarkM</author>
<data>
<field name="doctext">
&lt;p&gt;Your bubble sort examples for O(n) and O(n log n) are the same (the first needs to be un-optimized). Also, I believe the optimized bubble sort is O(n&lt;sup&gt;2&lt;/sup&gt;/2), not O(n log n).&lt;/p&gt;

&lt;p&gt;For your second suggestion, loops that can break out early are still O(n) in the worst case, as no guarantee can be made that all other elements will not be considered before the target element.&lt;/p&gt;
</field>
<field name="root_node">
227909</field>
<field name="parent_node">
227946</field>
</data>
</node>
