Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)
WOLFRAM LANGUAGE FEATURED EXAMPLE

Implement the Bubble Sort Algorithm with Patterns and Rules

    
Generate a sample dataset:
In[1]:=
Click for copyable input
Out[1]=
Use ReplaceRepeated () to implement the bubble sort:
In[2]:=
Click for copyable input
Out[2]=
Verify the result by comparing it with the Sort function:
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=