Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在学习循环排序并且对为什么循环排序的外循环运行(n-1)次而不是n次感到困惑。(n是数组大小)
for (int cycle_start=0; cycle_start< n-1; cycle_start++)
请解释。谢谢
在循环排序中,最后一项将自动位于正确的位置,因此您无需遍历它。