Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Patience sorting
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Overview== The algorithm's name derives from a simplified variant of the patience card game. The game begins with a shuffled deck of cards. The cards are dealt one by one into a sequence of piles on the table, according to the following rules.<ref name="Burstein">{{cite journal |journal=Séminaire Lotharingien de Combinatoire |volume=54A |year=2006 |title=Combinatorics of patience sorting piles |first1=Alexander |last1=Burstein |first2=Isaiah |last2=Lankham |url=http://www.emis.de/journals/SLC/wpapers/s54Aburlank.pdf|bibcode=2005math......6358B |arxiv=math/0506358 }}</ref> # Initially, there are no piles. The first card dealt forms a new pile consisting of the single card. # Each subsequent card is placed on the leftmost existing pile whose top card has a value greater than or equal to the new card's value, or to the right of all of the existing piles, thus forming a new pile. # When there are no more cards remaining to deal, the game ends. This card game is turned into a two-phase sorting algorithm, as follows. Given an array of {{mvar|n}} elements from some [[Total order|totally ordered]] domain, consider this array as a collection of cards and simulate the patience sorting game. When the game is over, recover the sorted sequence by repeatedly picking off the minimum visible card; in other words, perform a [[K-way merge|{{mvar|k}}-way merge]] of the {{mvar|p}} piles, each of which is internally sorted.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)