Talk:Algorithms/Randomization

Added in a shuffle algorithm I used in a card game. Formating isn't perfect and there is little in the way of explanation.

Here is a source code for find-median that uses the idea presented in the text, excluding the separation into 'partition' and 'find'. This code works (well at least for a bunch of tests that I did). It partially sorts the array, so that values on the left hand side of the array are less then values on the right hand side of it. Its time complexity is O(n), because it make one pass, and its memory complexity is O(n), because it creates a copy of the array, in order not to change the original. If original array is allowed to be changed, then, this can be modified so that memory complexity is constant.

I hope this code will help the writers of this section or anybody else. the programming language is JAVA. The license is GFDL of cource:) -- codalyzer-93.173.252.100 (talk) 14:24, 13 May 2009 (UTC)

Algorithm in that code is not randomized at all and doesn't compute median either (try to set that array to (10,7,3,88,55,21,-2,3,0,1,65,35,25,90,2) ). On basis of writer having obviously no clue, I'm gonna remove his edits... MacHala (discuss • contribs) 13:14, 21 December 2012 (UTC)