Sha256: 4f4901c12b1d11b13f83f39e653aaa928fe187e9e85d86794f41adbb19509a66

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

---
layout: algorithm
title: Bubble Sort
---

h1. Bubble Sort

h2. Sorting

h3. Descrição

Bubble sort, also known as sinking sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements "bubble" to the top of the list. Because it only uses comparisons to operate on elements, it is a comparison sort. The equally simple insertion sort has better performance than bubble sort, so some have suggested no longer teaching the bubble sort.

h3. Complexidade

O(n^2)

h3. Referências

http://en.wikipedia.org/wiki/Bubble_sort

h3. Implementações

|_. Linguagem |_. Comentário |_. Código fonte |_. Tempo de execução médio |
| c++ | Implementação simples em C++ | "ver":../../../../implementations/2011/01/01/Implementa%C3%A7%C3%A3o_simples_em_C++.html | 0.003s |
| ruby | Implementação simples em Ruby | "ver":../../../../implementations/2011/01/01/Implementa%C3%A7%C3%A3o_simples_em_Ruby.html | 0.006500000000000001s |

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jeka-0.1.1 test/site/algorithm.textile
jeka-0.1.0 test/site/algorithm.textile