id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

tmhscs@gmail.com sort > sort_selectionSortOnePass
prev  |  next  |  chance

Given an integer array, sort it from least to greatest using the Selection Sort Algorithm. On this problem, perform only one swap using the selection sort algorithm. It should find the smallest element in the array and swap it with the first position in the array.


sort_selectionSortOnePass([5, 4, 3, 2, 1]) → [1, 4, 3, 2, 5]
sort_selectionSortOnePass([4, 3, 2, 5]) → [2, 3, 4, 5]
sort_selectionSortOnePass([3, 4, 5]) → [3, 4, 5]

...Save, Compile, Run (ctrl-enter)

public int[] sort_selectionSortOnePass(int[] nums){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy