Last active
March 29, 2023 20:18
-
-
Save kraftpunk97/7d8a19c81d43fedf1fe3c5c7b4534873 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def func(list1, list2): | |
list1_ = [item for item in list1] | |
list2_ = [item for item in list2] | |
for ind in range(len(list1_)): | |
min_index = ind | |
for j in range(ind + 1, len(list1_)): | |
# select the minimum element in every iteration | |
if list2_[j] < list2_[min_index]: | |
min_index = j | |
# swapping the elements to sort the array | |
(list1_[ind], list1_[min_index]) = (list1_[min_index], list1_[ind]) | |
(list2_[ind], list2_[min_index]) = (list2_[min_index], list2_[ind]) | |
return list1_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment