Home / Expert Answers / Computer Science / please-solve-the-following-selection-sort-code-in-python-only-according-to-the-starter-code-only-p-pa308

(Solved): PLEASE solve the following Selection sort code in PYTHON ONLY, according to the starter code ONLY. P ...



PLEASE solve the following Selection sort code in PYTHON ONLY, according to the starter code ONLY. Please make sure the starter code works.

selection_sort(aList, field, dir)
(3 pts)
The function takes a nested list as described on page 2, the field index, and the d
def selection_sort(alist, field, dir):
\( \gg \) fileSet \( = \) [[cow, pdf, 2021-05-12 05:35, 2500], [snake, docx,
-1 seletetin sort fabist, tfold, dirl: 4HF
If coobens onet,


defe selection, sort (aList, field, dit) :
SPP Fileset  [[cow, pdf, 2021,05-12 05:35, 2500], [snake, docx, 2021-0
selection_sort(aList, field, dir) (3 pts) The function takes a nested list as described on page 2, the field index, and the direction of the sort, either Ascending or Descending. The function returns aList where the elements are arranged such that the desired field is sorted in the desired order. The function should implement the selection sort algorithm in-place (modifies the original list). Using amv other sorting algorithm will result in no credit for this fimction. def selection_sort(alist, field, dir): \( \gg \) fileSet \( = \) [['cow', 'pdf', '2021-05-12 05:35', 2500], ['snake', 'docx', '2021-06-12 05:29', 15200], ['sara', 'txt', '2021-05-12 05:35', 2500], ['puff adder', 'docx', '2021-06-12 05:29', 15200], ['python3', 'exe', '2021-05-12 05:35', 2500], ['rattler', 'msi', '2021-06-12 05:29', 5200], ['pandas', 'exe', '2021-05-12' \( \left.05: 35^{\prime}, 2500\right] \), ['cobra', 'psd', '2021-06-12 05:29', 135700]] \( \gg \) selection_sort(fileset, 0 , ' \( A \) ') [['cobra', 'psd', '2021-06-12 05:29', 135700], ['cow', 'pdf', '2021-05-12 05:35', 2500], ['pandas', 'exe', '2021-05-12 05:35', 2500], ['puff adder', 'docx', '2021-06-12 05:29', 15200], ['python3', 'exe', '2021-05-12 05:35', 2500], ['rattler', 'msi', '2021-06-12 05:29', 5200],' ['sara', 'txt', '2021-05-12 05:35', 2500], ['snake', 'docx', '2021-06-12 05:29', 15200]] \( \gg \) selection_sort(fileset, \( 0,{ }^{\prime} \mathrm{B} \) ') \# YOUR CODE STARTS HERE pass -1 seletetin sort fabist, tfold, dirl: 4HF If cooben's 'onet', defe selection, sort (aList, field, dit) : SPP Fileset " [['cow', "pdf', '2021,05-12 05:35', 2500], ['snake', 'docx', '2021-06-12 05:29' P3? aelaction siort (filestet, 0 , 'A') phor selection sort (fileSet, 0 , 'B') F YOUR CODF STARTS HERE


We have an Answer from Expert

View Expert Answer

Expert Answer


CODE Language Used = Python # function to sort a list using selection sort in-place def selection_sort(aList, field, dir): if len(aList) <= 1: return
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe