Simulation of different sort algorithms in js