mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix(curriculum): clarify selection sort lab swap requirement (#65885)
This commit is contained in:
parent
a372fb6a1a
commit
95075822fb
@ -21,7 +21,8 @@ Selection sort results in a quadratic time complexity in the best, average, and
|
||||
1. Your `selection_sort` function should have one parameter that represents the list of items.
|
||||
1. Your `selection_sort` function should take a list and sort the items in place from smallest to largest.
|
||||
1. Your `selection_sort` function should modify the input list in-place, and return it once it's sorted.
|
||||
1. Your `selection_sort` function should follow the selection sort algorithm, swapping the smallest element from the unsorted portion of the list, with the first unsorted element.
|
||||
1. Your `selection_sort` function should follow the selection sort algorithm, swapping the smallest element from the unsorted portion of the list with the first unsorted element.
|
||||
1. Your `selection_sort` function should not perform unnecessary swaps when the smallest element is already in the correct position.
|
||||
1. Your `selection_sort` function should not use either the built-in `sort()` method or `sorted()` function.
|
||||
|
||||
# --hints--
|
||||
@ -123,7 +124,7 @@ Your `selection_sort` should modify the input list in-place. You should not use
|
||||
)
|
||||
```
|
||||
|
||||
Your `selection_sort` should follow the selection sort algorithm, swapping the minimum value in unsorted part of the list with first the unsorted element.
|
||||
Your `selection_sort` function should follow the selection sort algorithm, swapping the minimum value in the unsorted part of the list with the first unsorted element. Avoid unnecessary swaps when the minimum value is already in the correct position.
|
||||
|
||||
```js
|
||||
(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user