Sorting algorithms/Bubble sort: Difference between revisions

Content added Content deleted
(Properly ordering the languages)
m (Categorizing programming examples)
Line 5: Line 5:


==[[Ada]]==
==[[Ada]]==
[[Category:Ada]]
'''Compiler:''' GCC 4.1.2
'''Compiler:''' GCC 4.1.2


Line 53: Line 54:
{{array operation}}
{{array operation}}


==[[C++]]==
==[[C plus plus|C++]]==
[[Category:C plus plus]]
'''Compiler:''' g++ 4.0.2
'''Compiler:''' g++ 4.0.2


Line 104: Line 106:


==[[Perl]]==
==[[Perl]]==
[[Category:Perl]]
'''Interpreter:''' perl 5.8.8
'''Interpreter:''' perl 5.8.8


Line 152: Line 155:


==[[Python]]==
==[[Python]]==
[[Category:Python]]

def bubblesort(x):
def bubblesort(x):
for i in range(len(x) - 2):
for i in range(len(x) - 2):
Line 164: Line 167:


==[[Ruby]]==
==[[Ruby]]==
[[Category:Ruby]]
Sorting can be done with the sort method
Sorting can be done with the sort method
new_array = [3, 78, 4, 23, 6, 8, 6].sort
new_array = [3, 78, 4, 23, 6, 8, 6].sort