diff --git a/Chapter12/Chap12-6.js b/Chapter12/Chap12-6.js index 2e567d0..ae96a5a 100644 --- a/Chapter12/Chap12-6.js +++ b/Chapter12/Chap12-6.js @@ -1,13 +1,11 @@ + function selectionSort() { - var min, temp; for (var outer = 0; outer <= this.dataStore.length-2; ++outer) { - min = outer; for (var inner = outer + 1; inner <= this.dataStore.length-1; ++inner) { - if (this.dataStore[inner] < this.dataStore[min]) { - min = inner; + if (this.dataStore[inner] < this.dataStore[outer]) { + swap(this.dataStore, inner, outer); } } - swap(this.dataStore, outer, min); } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy