rabi.cpp (fixed sort routine)