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

 

norm.krumpe@muohio.edu arrays > bubbleSortPasses
prev  |  next  |  chance

Implement the specified number of passes of bubble sort. Normally, sorting algorithms should have return type void. But codingbat doesn't work that way. So, return the array at the end of the method.


bubbleSortPasses([47, 2, 18, 6, 3, 59, 2, 8, 19, 5], 1) → [2, 18, 6, 3, 47, 2, 8, 19, 5, 59]
bubbleSortPasses([47, 2, 18, 6, 3, 59, 2, 8, 19, 5], 2) → [2, 6, 3, 18, 2, 8, 19, 5, 47, 59]
bubbleSortPasses([47, 2, 18, 6, 3, 59, 2, 8, 19, 5], 3) → [2, 3, 6, 2, 8, 18, 5, 19, 47, 59]

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

int[] bubbleSortPasses(int[] nums, int passes) { }

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

Difficulty: 200

Copyright Nick Parlante 2017 - privacy