Skip to Content
Mastering Python Design Patterns - Second Edition
book

Mastering Python Design Patterns - Second Edition

by Kamon Ayeva, Sakis Kasampalis
August 2018
Intermediate to advanced
248 pages
5h 51m
English
Packt Publishing
Content preview from Mastering Python Design Patterns - Second Edition

Strategy pattern

Most problems can be solved in more than one way. Take, for example, the sorting problem, which is related to putting the elements of a list in a specific order.

There are many sorting algorithms, and, in general, none of them is considered the best for all cases j.mp/algocomp.

There are different criteria that help us pick a sorting algorithm on a per-case basis. Some of the things that should be taken into account are listed here:

  • A number of elements that need to be sorted: This is called the input size. Almost all the sorting algorithms behave fairly well when the input size is small, but only a few of them have good performance with a large input size.
  • The best/average/worst time complexity of the algorithm: Time complexity ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Python Design Patterns - Second Edition - Second Edition

Learning Python Design Patterns - Second Edition - Second Edition

Chetan Giridhar, Gennadiy Zlobin

Publisher Resources

ISBN: 9781788837484Supplemental Content