Array Random Sorting

Status
You're currently viewing only qball's posts. Click here to go back to viewing the entire thread.
Not open for further replies.

qball

Ars Tribunus Militum
2,238
Completely random. It might pick it first, or pick a million other cards first. In actual use, however, the loop ran instantly (in Java) when asked to produce 52 different cards.

This is true, however from a statistics point of view the expected number of trials until you hit the ith card to deal out of N is N/(N-i+1). I believe that you can't technically use Big-O because Big-O specifies a worst case bound, but the expected running time will be n^2.

I think you're confusing me with the guy who started the thread. I was just trying to help him.

So was I actually. I'm still curious as to the actual algorithm that he used though.

-Q
 
Status
You're currently viewing only qball's posts. Click here to go back to viewing the entire thread.
Not open for further replies.