Content deleted Content added
→How is this stable sort example?: reference evolving page over at sandbox |
|||
Line 832:
:See [[User:Lent/sandbox]]
:Thanks --[[User:Lent|Lent]] ([[User talk:Lent|talk]]) 11:20, 29 February 2020 (UTC)
===Static stable sorting example===
{| class="wikitable"
|+ {{nowrap|Unsorted table→Sorted by State Code→ Stable Sort by State,
then City}}
! Row !! scope="col" |'''City'''!! {{vert header|stp=1|'''State'''}} !! Old<br>vs.<br>New<br>Row !! '''City'''!! {{vert header|stp=1|'''State'''}} !! Original<br>vs.<br>Sort<br>then<br>Another<br>stable sort!! '''City'''!! {{vert header|stp=1|'''State'''}}
|-
|1 || Chicago || IL || 13 → 1||{{font color|red|Rockford}} || {{font color|red|IA}} || 13 → 1 → 1 ||{{font color|red|Rockford}} || {{font color|red|IA}}
|-
| {{ font color|blue|2}} || {{font color|blue|Rockford}} || {{font color|blue|IL}} || 2 → 2|| {{font color|blue|Rockford}} || {{font color|blue|IL}} || 4 → 5 → 2 || Champaign || IL
|-
|3 || Evanston || IL || 3 → 3|| Evanston || IL || 1 → 4 → 3 || Chicago || IL
|-
|4 || Champaign || IL || 1 → 4|| Chicago || IL || 3 → 3 → 4 || Evanston || IL
|-
|5 || Detroit || MI || 4 → 5|| Champaign || IL || 2 → 2 → 5 || {{font color|blue|Rockford}} || {{font color|blue|IL}}
|-
| {{font color|green|6}} || {{font color|green|New York}} || {{font color|green|NY}} || 12 → 6|| {{font color|violet|Rockford}} || {{font color|violet|MI}} || 5 → 7 → 6 || Detroit || MI
|-
|7 || Buffalo || NY || 5 → 7|| Detroit || MI || 12 → 6 → 7 || {{font color|violet|Rockford}} || {{font color|violet|MI}}
|-
|8 || Milwaukee || WI || 15 → 8|| Rockford || MN || 15 → 8 → 8 || Rockford || MN
|-
|9 || Albany || NY || 11 → 9|| {{font color|brown|Syracuse}} || {{font color|brown|NY}} || 9 → 12 → 9 || Albany || NY
|-
|10 || Green Bay || WI || 6 → 10|| {{font color|green|New York}} || {{font color|green|NY}} || 7 → 11 → 10 || Buffalo || NY
|-
| {{font color|brown|11}} || {{font color|brown|Syracuse}} || {{font color|brown|NY}} || 7 → 11|| Buffalo || NY || 6 → 10 → 11 || {{font color|green|New York}} || {{font color|green|NY}}
|-
| {{font color|violet|12}} || {{font color|violet|Rockford}} || {{font color|violet|MI}} || 9 → 12|| Albany || NY || 11 → 9 → 12 || {{font color|brown|Syracuse}} || {{font color|brown|NY}}
|-
| {{font color|red|13}} ||| {{font color|red|Rockford}} || {{font color|red|IA}} || 14 → 13|| Rockford || TN || 14 → 13 → 13 || Rockford || TN
|-
|14 || Rockford || TN || 8 → 14|| Milwaukee || WI || 10 → 15 → 14 || Green Bay || WI
|-
|15 || Rockford || MN || 10 → 15|| Green Bay || WI || 8 → 14 → 15 || Milwaukee || WI
|}
|