Added C++ introsort implementations to convert later to C