冒泡排序

  1. #ifndef BUBBLING_INSERT_H[
  2. #define BUBBLING_INSERT_H
  3. void bubblingInsert(int *arr,int Length);
  4. void bubblingInsert(int *arr,int Length){
  5. int temp;
  6. for(int i=0;i<Length ;i++){
  7. for(int j=0;j<Length-1-i; j++){
  8. if(arr[j]>arr[j+1]){
  9. temp=arr[j];
  10. arr[j]=arr[j+1];
  11. arr[j+1]=temp;
  12. }
  13. }
  14. }
  15. }
  16. #endif





原文地址:https://www.cnblogs.com/yml435/p/4655551.html