No idea about the true intricacies of the algorithm behind, but even in casual I've had truly baffling matchmakings, not further than yesterday, 1 Tank, 1 melee DPS, 3 ranged DPS, versus 2 Tanks, 2 melee DPS, 1 ranged DPS... I've also seen other combinations where one team could have definitely spared a healer or melee so that both teams would have an equal amount on both sides, but alas...