On Jan 4, 2:15 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 04 Jan 2008 09:29:50 -0800, bukzor wrote: > > Why cant you implement < for complex numbers? Maybe I'm being naive, but > > isn't this the normal definition? > > a + bi < c + di iff sqrt(a**2 + b**2) < sqrt(c**2, d**2) > > No, it is not. Ordered comparisons are not defined for complex numbers. > Which is bigger, 4+2j or 2+4j? > > > How do you implement a set without sorting? > > With a hash table. > > Or if you are willing to limit yourself to sets of small integers, you > can implement it using bit flipping. E.g. 5 is an element of the set if > bit 5 is on. > > > Are you expecting better than O(log n)? > > Sure. > > -- > Steven
Good Answers! -- http://mail.python.org/mailman/listinfo/python-list