the C and Python version of bubble sort