View full-text article in PMC Sensors (Basel). 2020 Apr 29;20(9):2513. doi: 10.3390/s20092513 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/). PMC Copyright notice Algorithm 10 sortClusters. Input: Z→^,c→^is,k→^ Output: Z→^,c→^is 1:score=0,index=0,row→,flag=1 2:forh←1 to |P→^is| do 3: flag=0 4: for g←2;g<|P→^is|∧flag;g←g+1 do 5: if k^g<k^g−1 then 6: index=o^g−1s //swap elements 7: o^g−1s=o^gs 8: o^gs=index 9: row→=Z→^(g−1,∗) //swap elements 10: Z→^(g−1,∗)=Z→^(g,∗) 11: Z→^(g,∗)=row→ 12: flag=1 // indicates that a swap occurred. 13: end if 14: end for 15:end for