You are on page 1of 11

Paitence sort

Data structure presentation


Mosab_2802

INDEX.HTML
/CONTENTS OF THIS TEMPLATE

1. How the patience algorithm works


2. Worst case/best case
3. Code
4. reference

INDEX.HTML
patience sorting is a sorting algorithm inspired by, and
named after, the card game patience. A variant of the
algorithm efficiently computes the length of a
longest increasing subsequence in a given array.

INDEX.HTML
Worst case/best case

/01 /worst case /02 /best case

When the input data contain When the input data contain
natural decreasing sub-arrays, natural "runs", i.e., non-
then performance can be strictly decreasing sub-arrays, then
worse. performance can be strictly
better.
Worst case:
O(n log n) best case:
O(n)
Worst case/best case

Test run
Average time: 12,213 milliseconds
Amount:50,000 random numbers
Number of runs: 8
INDEX.HTML
INDEX.HTML
INDEX.HTML
INDEX.HTML
INDEX.HTML
/RESOURCES

https://en.wikipedia.org/wiki/Patience_sorting

https://www.geeksforgeeks.org/

INDEX.HTML

You might also like