7 kyu

Bubble Sort

721 of 983PrivateShorty

Description:

#Bubbleing around

Since everybody hates chaos and loves sorted lists we should implement some more sorting algorithms. Your task is to implement a Bubble sort (for some help look at https://en.wikipedia.org/wiki/Bubble_sort) and return a list of snapshots after each change of the initial list.

e.g.

If the initial list would be l=[1,2,4,3] my algorithm rotates l[2] and l[3] and after that it adds [1,2,3,4] to the result, which is a list of snapshots.

[1,2,4,3] should return [ [1,2,3,4] ]
[2,1,4,3] should return [ [1,2,4,3], [1,2,3,4] ]
[1,2,3,4] should return []
Sorting
Arrays
Fundamentals
Algorithms

Stats:

CreatedMay 21, 2016
PublishedMay 21, 2016
Warriors Trained2582
Total Skips36
Total Code Submissions3523
Total Times Completed983
Python Completions721
JavaScript Completions279
Total Stars41
% of votes with a positive feedback rating89% of 187
Total "Very Satisfied" Votes156
Total "Somewhat Satisfied" Votes21
Total "Not Satisfied" Votes10
Total Rank Assessments15
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • PrivateShorty Avatar
  • aryan-firouzian Avatar
  • Mednoob Avatar
  • saudiGuy Avatar
Ad