
Help sorting arrays
I need to sort an array using quicksort, selection sort, and bubblesort or insertion sort.
Anyone know of some good sites to find the code I need? I've looked at some tutorials, but I'm not sure how to implement what I've seen to my arrays in particular.
Thanks!

Here's bubble sort, but you're better off doing the insertion sort since it's more useful
Code:
#include <iostream>
using namespace std;
int main()
{
int a[] = {5,4,7,6,3,7,1};
// Simple bubble sort
for (int i = 0; i < 7; i++)
{
for (int j = i; j < 7; j++)
{
if (a[j] < a[i])
{
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
for (int k = 0; k < 7; k++)
cout<< a[k] <<' ';
cout<<endl;
}
However, since I won't give you the code for all of them, you can find info and implementations here.


That really helps a lot, thank you both for your help, i'll try it out now! :)
