Talk:Sorting algorithm: Difference between revisions

Content deleted Content added
How is this stable sort example?: Static Stable Sorting Example
Static stable sorting example: add table with dividers
Line 868:
|15 || Rockford || MN || 10 → 15|| Green Bay || WI || 8 → 14 → 15 || Milwaukee || WI
|}
===Static Stable sorting tables with dividers===
 
{| class="wikitable"
|+ {{nowrap|Unsorted table→Sorted by State Code→ Stable Sort by State,
then City}}
! Row !! scope="col" |'''City'''!! {{vert header|stp=1|'''State Code'''}} !! style="background: blue;" | !! Old<br>&#x2192;<br>New<br>Row !! '''City'''!! {{vert header|stp=1|'''State Code'''}} !! style="background: blue;" | !! Original<br>&#x2192;<br>Initial Sorting<br>&#x2192;<br>Following<br>stable sort!! '''City'''!! {{vert header|stp=1|'''State Code'''}}
|-
|1 || Chicago || IL || style="background: blue;" | || 13 &#x2192; 1||{{font color|red|Rockford}} || {{font color|red|IA}} || style="background: blue;" | || 13 &#x2192; 1 &#x2192; 1 ||{{font color|red|Rockford}} || {{font color|red|IA}}
|-
| {{ font color|blue|2}} || {{font color|blue|Rockford}} || {{font color|blue|IL}} || style="background: blue;" | || 2 &#x2192; 2|| {{font color|blue|Rockford}} || {{font color|blue|IL}} || style="background: blue;" | || 4 &#x2192; 5 &#x2192; 2 || Champaign || IL
|-
|3 || Evanston || IL || style="background: blue;" | || 3 &#x2192; 3|| Evanston || IL || style="background: blue;" | || 1 &#x2192; 4 &#x2192; 3 || Chicago || IL
|-
|4 || Champaign || IL || style="background: blue;" | || 1 &#x2192; 4|| Chicago || IL || style="background: blue;" | || 3 &#x2192; 3 &#x2192; 4 || Evanston || IL
|-
|5 || Detroit || MI || style="background: blue;" | || 4 &#x2192; 5|| Champaign || IL || style="background: blue;" | || 2 &#x2192; 2 &#x2192; 5 || {{font color|blue|Rockford}} || {{font color|blue|IL}}
|-
| {{font color|green|6}} || {{font color|green|New York}} || {{font color|green|NY}} || style="background: blue;" | || 12 &#x2192; 6|| {{font color|violet|Rockford}} || {{font color|violet|MI}} || style="background: blue;" | || 5 &#x2192; 7 &#x2192; 6 || Detroit || MI
|-
|7 || Buffalo || NY || style="background: blue;" | || 5 &#x2192; 7|| Detroit || MI || style="background: blue;" | || 12 &#x2192; 6 &#x2192; 7 || {{font color|violet|Rockford}} || {{font color|violet|MI}}
|-
|8 || Milwaukee || WI || style="background: blue;" | || 15 &#x2192; 8|| Rockford || MN || style="background: blue;" | || 15 &#x2192; 8 &#x2192; 8 || Rockford || MN
|-
|9 || Albany || NY || style="background: blue;" | || 11 &#x2192; 9|| {{font color|brown|Syracuse}} || {{font color|brown|NY}} || style="background: blue;" | || 9 &#x2192; 12 &#x2192; 9 || Albany || NY
|-
|10 || Green Bay || WI || style="background: blue;" | || 6 &#x2192; 10|| {{font color|green|New York}} || {{font color|green|NY}} || style="background: blue;" | || 7 &#x2192; 11 &#x2192; 10 || Buffalo || NY
|-
| {{font color|brown|11}} || {{font color|brown|Syracuse}} || {{font color|brown|NY}} || style="background: blue;" | || 7 &#x2192; 11|| Buffalo || NY || style="background: blue;" | || 6 &#x2192; 10 &#x2192; 11 || {{font color|green|New York}} || {{font color|green|NY}}
|-
| {{font color|violet|12}} || {{font color|violet|Rockford}} || {{font color|violet|MI}} || style="background: blue;" | || 9 &#x2192; 12|| Albany || NY || style="background: blue;" | || 11 &#x2192; 9 &#x2192; 12 || {{font color|brown|Syracuse}} || {{font color|brown|NY}}
|-
| {{font color|red|13}} ||| {{font color|red|Rockford}} || {{font color|red|IA}} || style="background: blue;" | || 14 &#x2192; 13|| Rockford || TN || style="background: blue;" | || 14 &#x2192; 13 &#x2192; 13 || Rockford || TN
|-
|14 || Rockford || TN || style="background: blue;" | || 8 &#x2192; 14|| Milwaukee || WI || style="background: blue;" | || 10 &#x2192; 15 &#x2192; 14 || Green Bay || WI
|-
|15 || Rockford || MN || style="background: blue;" | || 10 &#x2192; 15|| Green Bay || WI || style="background: blue;" | || 8 &#x2192; 14 &#x2192; 15 || Milwaukee || WI
|}
 
===Stable sorting example===