sorts.patience_sort

Attributes

user_input

Classes

Stack

Built-in mutable sequence.

Functions

patience_sort(→ list)

A pure implementation of patience sort algorithm in Python

Module Contents

class sorts.patience_sort.Stack

Bases: list

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

__eq__(other)

Return self==value.

__lt__(other)

Return self<value.

sorts.patience_sort.patience_sort(collection: list) list

A pure implementation of patience sort algorithm in Python

Parameters:

collection – some mutable ordered collection with heterogeneous

comparable items inside :return: the same collection ordered by ascending

Examples: >>> patience_sort([1, 9, 5, 21, 17, 6]) [1, 5, 6, 9, 17, 21]

>>> patience_sort([])
[]
>>> patience_sort([-3, -17, -48])
[-48, -17, -3]
sorts.patience_sort.user_input