hand-writing algorithms (sort)

//bubble sort

#include

#include

using namespace std;

int main()

{

vector a;

int temp=0;

for(int i=1;i<=a.length();i++)

{

  for(int j=0;j

  {

  if(a[j]>a[j+1])

  {

  temp=a[j];

  a[j]=a[i];

  a[i]=temp;

  }

  }

}

return 0;

}



你可能感兴趣的:(hand-writing algorithms (sort))