From 95075822fb5c2c2e0edffafbc8082e1d66b51985 Mon Sep 17 00:00:00 2001 From: Jeevankumar S <110320697+Jeevankumar-s@users.noreply.github.com> Date: Tue, 17 Feb 2026 17:46:56 +0530 Subject: [PATCH] fix(curriculum): clarify selection sort lab swap requirement (#65885) --- .../blocks/lab-selection-sort/680b3ef395479b0e449ecb6e.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/blocks/lab-selection-sort/680b3ef395479b0e449ecb6e.md b/curriculum/challenges/english/blocks/lab-selection-sort/680b3ef395479b0e449ecb6e.md index 18034e688f7..0fe181ef095 100644 --- a/curriculum/challenges/english/blocks/lab-selection-sort/680b3ef395479b0e449ecb6e.md +++ b/curriculum/challenges/english/blocks/lab-selection-sort/680b3ef395479b0e449ecb6e.md @@ -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 (