Your stackoverflow changes

First of all get rid of the suffle in the constructors to get right comparison.

Second, the behavior is expected, since in the basic version you are only doing the switch if you find the right candidate in both side, whereas the 3way version you are doing a switch anyway unless the element is equal to the pivot.