Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. Spaghetti sort is
a linear-time, analog algorithm for sorting a sequence of items,
introduced by Alexander Dewdney in his Scientific American column. It is
used as an example of quantum computing reducing the running time of
generalized sorting algorithms from O(Nlog N) to O(N). Preparing the n
rods of spaghetti takes linear time. Lowering the rods on the table
takes constant time, O(1). This is possible because the hand, the
spaghetti rods and the table work as a fully parallel computing device.
There are then n rods to remove so, assuming each contact-and-removal
operation takes constant time, the worst-case time complexity of the
algorithm is O(n).