Sort stability: Difference between revisions

Line 568:
}
Call Stable
 
</lang>
Output:
UK London
 
UK Birmingham
 
US New York
US Birmingham
 
</lang>
 
US Birmingham
 
 
Line 602:
}
Call Stable1
</lang>
 
Output:
UK Birmingham
 
UK London
 
US Birmingham
 
US New York
 
</lang>
 
Now second column is sorting (but it is one column all, no two columns). So lets see the unstable sort. Because all keys now are unique we just remove queue from Inventory definition.
Line 636 ⟶ 633:
}
Call Stable2
</lang>
 
Output:
UK Birmingham
 
UK London
 
US Birmingham
 
US New York
 
</lang>
 
 
 
 
Anonymous user