Algorithms

Visualizing Algorithms

http://bost.ocks.org/mike/
http://bost.ocks.org/mike/algorithms/

Shuffle an Array

http://bost.ocks.org/mike/shuffle/
http://en.wikipedia.org/wiki/Fisher–Yates_shuffle
http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript

function shuffle(arrToShuffle) {
    for (
        var j, arrTmp, i = arrToShuffle.length;
        i;        // if i==0 => false => break

        j = Math.floor(Math.random() * i),
          
arrTmp = arrToShuffle[--i],
           arrToShuffle[i] = arrToShuffle[j],
           arrToShuffle[j] = arrTmp);

        return arrToShuffle;
}

 

Loading