O() only speaks of scalability. It doesn't show that nothing was saved. It wouldn't surprise me to find that Corion's approach is faster, even for long lists. Besides, speed is not the only factor that affects the choice of tools. That said, I don't see the point of sorting here.