* 从想法到解决方案 for (int i = 0; i list.length; i++) { select the smallest element in list[i..listSize-1]; swap the smallest with list[i], if necessary; // list[i] is in its correct position. // The next iteration apply on list[i..listSize-1] } list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] ... list[0] list[1] list[2] list[3] ... list[10] * 扩展为 for (int i = 0; i listSize; i++) { select the smallest element in list[i..listSize-1]; swap the smallest with list[i], if necessary; // list[i] is in its correct position. // The next iteration apply on list[i..listSize-1] } double currentMin = list[i]; int currentMinIndex = i; for (int j = i; j list.length; j++) { if (currentMin list[j]) { currentMin = list[j]; currentMinIndex = j; } } * 扩展为 for (int i = 0; i listSize; i++) { select the smallest element in list[i..listSize-1]; swap the smallest with list[i], if necessary; // list[i] is in its correct position. // The next iteration apply on list[i..listSize-1] } double currentMin = list[i]; int currentMinIndex = i; for (int j = i; j list.length; j++) { if (currentMin list[j]) { currentMin = list[j]; currentMinIndex = j; } } * 扩展为 for (int i = 0; i listSize; i++) { select the smallest element in list[i..listSize-1]; swap the smallest with list[i], if necessary; // list[i] is in its correct position. // The next iteration apply on list[i..listSize-1] } if (currentMinIndex != i) { list[currentMinIndex] = list[i]; list[i] = currentMin; } * 将它们放在一个方法中 /** The method for sorting the numbers */ public static void selec
您可能关注的文档
最近下载
- Unit 1 Animal friends Speed up(课件)外研版(三起)(2024)英语三年级下册.pptx VIP
- 医药企业医院廉洁承诺范文.docx VIP
- 小学综合实践活动一年级下册第四单元《碗筷的摆放和收拾》课件.docx VIP
- Python少儿编程(第1-17课).pptx VIP
- 2026及未来5年中国活检针行业发展研究报告.docx
- 汽车检测诊断技术.pptx VIP
- 小学综合实践活动一年级下册第四单元《碗筷的摆放和收拾》课件.pptx VIP
- 四川省成都市第七中学2025-2026学年高一上学期11月半期考试英语(含答案).pdf
- 集成电路原理与设计之一数字教案_chap.pdf VIP
- python少儿编程课程-第6课:周而复始(for循环).pptx VIP
原创力文档

文档评论(0)