Fix C++ compatibility for bubble and bucket sort