Merge and Quick sorts in JS and C