Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7312 > unrolled thread

Re: reliably sort?

Started byBill Rowe <readnews@sbcglobal.net>
First post2011-12-17 07:52 +0000
Last post2011-12-17 07:52 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: reliably sort? Bill Rowe <readnews@sbcglobal.net> - 2011-12-17 07:52 +0000

#7312 — Re: reliably sort?

FromBill Rowe <readnews@sbcglobal.net>
Date2011-12-17 07:52 +0000
SubjectRe: reliably sort?
Message-ID<jchho9$ikh$1@smc.vnet.net>
On 12/16/11 at 5:54 AM, ulrich.arndt@data2knowledge.de (Ulrich Arndt)
wrote:

>Union and Sort seems not naturally connected to me. Union is a set
>operation and according to the documentation it seems that the
>implementation is using some sorting...

As mathematical operations union and sort are not connected.
That is there is no mathematical reason to sort a group of items
to do the mathematical operation of union. But, you need to keep
in mind the practical implementation of these operations on a computer.

To perform an union (on an unordered set) you would need to
compare each element with every other element, i.e., n^2
compares. But if the set is sorted, you only need compare each
element to the next element for n compares. Since there are sort
algorithms that are more efficient than n^2, the most efficient
way to implement union is to first use an efficient sort
algorithm then do the union. Although I don't work for Wolfram
and do not have access to the source code for Mathematica, I am
certain Union does a Sort for the reason I've outlined.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web