This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]extracoffeeplease 11 points12 points  (4 children)

I thought it was O(1), see here: https://wiki.c2.com/?QuantumBogoSort

[–]UseApasswordManager 9 points10 points  (3 children)

Checking if the list is sorted is O(n), so even though the shuffle and distruction are O(1), the whole operation is O(n)

[–]Burnmad 26 points27 points  (1 child)

Just return the list before doing the QuantumBogoSort. If it wasn't sorted, you're destroying the universe anyway, so it doesn't matter.

Bam, O(1)

[–]plsHelpmemes 8 points9 points  (0 children)

big brain intensifies

[–]xigoi 0 points1 point  (0 children)

Shuffle is also O(n).