User:Lent/sandbox

From Wikipedia, the free encyclopedia

Max Annenberg

Max Annenberg, son of Moses Annenberg, brother of Walter Anneberg

Biographic sketch:[1]

1925 Relocation to New York. [2]

On December 7, 1941, before the news of the bombing of Pearl Harbor was made public, a public address message for Max Annenberg's chauffeur to report, has followed the message for Col. William J. Donovan to call his office immediately, with the third and final message being for military personnel to report to their bases.[3][4]

Introduction to interactive example

Only some of the many sorting algorithms currently developed are known as stable. The quality that makes these algorithms stable is that when sorting on a row in a table, if the value in the column chosen to be the sort "key" is identical to another row's value in that same "key" column, the algorithm will leave the relative order of those rows unchanged. The notable sorting algorithm, Quicksort, is usually implemented lacking stability.

Mobile Browsers vs. Sortable tables

Wikipedia supports sortable tables in desktop browsers, including stable sorting by using the Shift key while clicking on the second column to be sorted. Sadly, as of February 2020, sortable Wikipedia tables only work with desktop browsers. Even mobile browsers set to "View Desktop Site/Desktop Page" mode fail to work with Javascript code which provides Wikipedia's sortable columns. Originally, mobile browsers had extremely limited hardware resources, making a full-feature browser impossible.[5] While innovative solutions such as the Wireless Application Protocol allowed more of the web to be browsed, the results were extremely varied. As mobile devices grew in power, and browser capabilities continued to grow, Wikipedia's developers and users returned to the problem, keeping in consideration extremely limited mobile devices still in widespread use around the world.[6]


Icons buttons found on Column Headers

More information Icon, Icon Name ...
Icons for sorting columns
IconIcon Name
sort_both
sort_both
sort_down
sort_down
sort_up
sort_up
Close

The browser currently displaying this page is capable of sorting tables, the preceding icon buttons should be on each column header. If not, interactive sorting for will not work, so "No soup for you!". If the following tables show no icons in the column headers, your browser is cannot performing sorting at this time.

Stable sort by State then City

The following example has fifteen cities in seven different states.

Each state is abbreviated using the 2-letter codes used by the United States Postal Service.

Rationale for Postal Codes

After suffering from duplicate city names within the U.S., the Post Office made an effort to keep new duplicate names from occurring:

To help address this problem, in the 1880s the instructions on selecting new Post Office names went [...]:
Select a short name for the proposed office, which, when written, will not resemble the name of any other post office in the United States.

What's in a (Post Office) Name? : From Aaronsburg, Pennsylvania, to Zwolle, Louisiana, [7]

This was found to be too restrictive, and the Post Office removed the word United.:

In the 1890s this was relaxed:
Select a short name for the proposed office, which, when written, will not resemble the name of any other post office in the State.

What's in a (Post Office) Name? : From Aaronsburg, Pennsylvania, to Zwolle, Louisiana, [7]

The Postal zone introduced in 1943 helped route mail within large U.S. cities, and 1963's introduction of the ZIP Code helped improved delivery of mail to cities with the same name by first directing the mail to the correct region of the country. Standardization of the twoletter code for each state, territory and the capital district also made mail sorting easier.[8]


Example

Two stable sorts are performed on the randomly ordered, original table.

Note that only the second sort is required to be stable to get our desired result of a list which is alphabetical first by twoletter State code, then for each City within the alphabetically ordered State.

Mobile sorting workarounds

While not possible on most mobile browsers, sorting can be achieve through these workarounds:

  1. Obtain a browser which wil support a Desktop site and the Javascript needed:
  2. Use a keyboard which supports a TAB key:
    • Bluetooth keyboard
    • USB keyboard via a USB On-The-Go cable
    • Virtual board which supports the TAB key , setting the keyboard visible, even when not on an input field
  3. Load the sortable page and verify that the column's sorting triangles are on the column titles
  4. Sort the selected primary column via:
    • Clicking on the column header to toggle trough ascending or descending sorting
    • Pressing TAB key on the keyboard, to move to the column, then pressing the Enter key.
  5. Press the TAB key or Shift and TAB key to position at the second sorting column and press Shift and Enter together.
  6. Now go and Square the Circle.



Table
More information Row, City ...
Unsorted table
RowCity
State
1ChicagoIL
2RockfordIL
3EvanstonIL
4ChampaignIL
5DetroitMI
6New YorkNY
7BuffaloNY
8MilwaukeeWI
9AlbanyNY
10Green BayWI
11SyracuseNY
12RockfordMI
13RockfordIA
14RockfordTN
15RockfordMN
Close
More information Oldvs.New Row, City ...
Sorted Alphabetically by only State
Old
vs.
New
Row
City
State
13 1RockfordIA
2 2RockfordIL
3 3EvanstonIL
1 4ChicagoIL
4 5ChampaignIL
12 6RockfordMI
5 7DetroitMI
15 8RockfordMN
11 9SyracuseNY
6 10New YorkNY
7 11BuffaloNY
9 12AlbanyNY
14 13RockfordTN
8 14MilwaukeeWI
10 15Green BayWI
Close
More information Originalvs.SortthenAnother stable sort, City ...
Sorted Alphabetically by State, then City
Original
vs.
Sort
then
Another
stable sort
City
State
13 1 1RockfordIA
4 5 2ChampaignIL
1 4 3ChicagoIL
3 3 4EvanstonIL
2 2 5RockfordIL
5 7 6DetroitMI
12 6 7RockfordMI
15 8 8RockfordMN
9 12 9AlbanyNY
7 11 10BuffaloNY
6 10 11New YorkNY
11 9 12SyracuseNY
14 13 13RockfordTN
10 15 14Green BayWI
8 14 15MilwaukeeWI
Close


Note that only the second sort is required to be stable to get our desired result, as once the rows are ordered by State, the cities can be in any order for the current State'. The second sort is required to be stable to keep the states in order, while alphabetizing the cities within the state.

Stable sort by City then State

In this case, when we sort by alphabetically by City, we almost have the list we want. The problem is that there are many rows with the city of Rockford. These cities are properly between New York, NY and Syracuse, NY, but the States for the cities of Rockford remain in their original, non-alphabetic order. With a second stable sort, we can sort our file, leaving all the unique cities in their place and taking the cities with equal names, that is the cities of Rockford, and putting them in alphabetic order by the codes of each one's twoletter State code.

More information Row, City ...
Unsorted table
RowCity
State
1ChicagoIL
2RockfordIL
3EvanstonIL
4ChampaignIL
5DetroitMI
6New YorkNY
7BuffaloNY
8MilwaukeeWI
9AlbanyNY
10Green BayWI
11SyracuseNY
12RockfordMI
13RockfordIA
14RockfordTN
15RockfordMN
Close
More information Row↘↓→ Source Current, City ...
Sorted Alphabetically by only City
Row
  Source
   Current
City
State
9 1AlbanyNY
7 2BuffaloNY
4 3ChampaignIL
1 4ChicagoIL
5 5DetroitMI
3 6EvanstonIL
10 7Green BayWI
8 8MilwaukeeWI
6 9New YorkNY
12 10RockfordMI
13 11RockfordIA
14 12RockfordTN
15 13RockfordMN
2 14RockfordIL
11 15SyracuseNY
Close
More information Originalvs.SortthenAnother stable sort, City ...
Sorted Alphabetically by City, then State
Original
vs.
Sort
then
Another
stable sort
City
State
9 1 1AlbanyNY
7 2 2BuffaloNY
4 3 3ChampaignIL
1 4 4ChicagoIL
5 5 5DetroitMI
3 6 6EvanstonIL
10 7 7Green BayWI
8 8 8MilwaukeeWI
6 9 9New YorkNY
13 11 10RockfordIA
2 14 11RockfordIL
12 10 12RockfordMI
15 13 13RockfordMN
14 12 14RockfordTN
11 15 15SyracuseNY
Close

Derived from Jeffery S. Leon's Sorting Algorithms — Stability". [10]

To sort by the above tables, click on the triangle. Then hold the Shift key and click on the triangle to sort by another column, while keeping the order for the first column when values of the second column are equal.

References

Temp workspace

VisualEditor vs. Citation bot

Failures of Flight Recorders

Related Articles

Wikiwand AI