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]=