Nimblefish interview question

Bubble Sort, with Optimizations.