Skip to content

Swift-Coding-Club-Thailand/BubbleSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

BubbleSort

Bubble Sort Algorithm for Swift Coding Club Advance

What is Bubble Sort??

Bubble_sort_animation bubble-short

  • Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the input list element by element, comparing the current element with the one after it, swapping their values if needed. These passes through the list are repeated until no swaps had to be performed during a pass, meaning that the list has become fully sorted. The algorithm, which is a comparison sort, is named for the way the larger elements "bubble" up to the top of the list.

How it work??

  1. Start at the beginning of the list.
  2. Compare the first item to the second item. If the first item is greater than the second item, swap them.
  3. Move on to the next pair of items and repeat the comparison. If the second item is greater than the third item, swap them.
  4. Continue this process until you reach the end of the list.
  5. If you made any swaps, go back to the beginning of the list and repeat the process until you can go through the entire list without making any swaps.

About

Bubble Sort Algorithm for Swift Coding Club Advance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages