bubble sort, quantum superpositions, and quantum unitaries arrays

Quantum computing may seem difficult, until you translate it into the language of Turing and enigma analysis.

If someone tells you about superposition and vector spaces, this just means a boolean truth table. The sum has n terms, one per each line of the “and” truth table (say). The trick is to realize that there are 2 representations: as state, as operator. The trivial representation as state is literally a sequence of addition terms, where each term has 3 bit elements for the 2 operands and their ‘and’. The operator realization of the same thing just varies the idea. One has a series of terms, as before, added in “superposition”, where each term is a ket of 2 bits and a bra of one “measured” bit (the and of the ket’s 2 terms).

Next! a quantum unitary is JUST the swap operation! as in you have an array of states, as a above, and you swap two. The array of states may be “a 1-dimensional representation of spin states”. Or, in our world, an array of superposition, as above. One can swap any 2 superposition, including 2 neighbors. Why is it unitary? Because you can unswap what you just swapped, next; meaning that the net result is identity.

At this point you should be thinking about enigma wheel wiring or its stecker, where “wires” in the wheel or wiring of the stecker swap things. One should be recalling how this means things are unitary!

Bubble sort (of an array, as above) had two implementations, when I learned the idea in second year computing course. One could choose the values to be swapped at random or enumerate the indexes and work systematically. It was an important lesson that the random “method” could achieve a better result, on average.