insertion.sort

insertion.sort - { cout << " " <<j...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; int main() { int a[10]={0, -3, 5, -99, 100, 99, -34, 7, 0 , 67}, i, j, min, minindex, temp, bottom=0; for(i=bottom;i<=9;i++) { cout << i << endl; min = a[i]; minindex= i; for(j=i+1;j<10;j++)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { cout << " " <<j <<endl; if(a[j] < min) { minindex = j; min = a[minindex]; } } temp = a[i]; a[i] = a[minindex]; a[minindex] = temp; bottom++; } for(i=0;i<=9;i++) cout << a[i] << " "; return 0; }...
View Full Document

This note was uploaded on 02/05/2012 for the course CIS 210 taught by Professor Feinstein during the Fall '10 term at S. Alabama.

Page1 / 2

insertion.sort - { cout << " " <<j...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online