This commit is contained in:
Miloslav Ciz 2024-10-23 20:14:11 +02:00
parent 6ac65ae709
commit ced34db6fa
15 changed files with 1851 additions and 1850 deletions

View file

@ -1,10 +1,10 @@
# Sorting
Sorting denotes the action of rearranging a sequence, such as a [list](list.md) of [numbers](number.md), so that the elements are put in a specific [order](order.md) (e.g. ascending or descending). It is the opposite of [shuffling](shuffle.md). In [computer science](compsci.md) sorting enjoys the status of a wide and curious topic, there are dozens, maybe hundreds of sorting [algorithms](algorithm.md), each with pros and cons and different attributes are being studied, e.g. the algorithm's [time complexity](time_complexity.md), stability etc. Sorting algorithms are a favorite subject of programming classes as they provide a good exercise for [programming](programming.md) and analysis of algorithms and can be nicely put on tests :) Sorting algorithms are like [Pokemon](pokemon.md) for computer nerds, some are big, some are small and cute and everyone has a favorite. { Gotta implement them all? ~drummyfish }
Sorting denotes the action of rearranging a sequence, such as a [list](list.md) of [numbers](number.md), so that the elements are put in a specific [order](order.md) (e.g. ascending or descending). It is the opposite of [shuffling](shuffle.md). In [computer science](compsci.md) sorting enjoys the status of a widely spanning, quite curious topic. There are probably hundreds of sorting [algorithms](algorithm.md) and their slight modifications, each with pros and cons -- attributes of these algorithms are being studied, e.g. their [time complexity](time_complexity.md), memory efficiency, stability etc. Sorting algorithms are also a favorite subject of [programming](programming.md) classes as they provide a good exercise for programming and analysis of algorithms and can be nicely put on a test :) Sorting algorithms are like [Pokemon](pokemon.md): some are big and heavy but winning in raw "strength", others are small and cute, some are just funny... and everyone probably has a favorite. { Gotta implement them all? ~drummyfish }
Some celebrities among sorting algorithms are the [bubble sort](bubble_sort.md) (a simple [KISS](kiss.md) algorithm), [quick sort](quick_sort.md) (a super fast one), [merge sort](merge_sort.md) (also lightning fast) and [stupid sort](bogosort.md) (just tries different [permutations](permutation.md) until it hits the jackpot).
In our day-to-day lives we commonly get away with some of the simplest, uncomplicated sorting algorithms (such as [bubble sort](bubble_sort.md) or [insertion sort](insertion_sort.md)) anyway, unless we're programming a database or otherwise treating enormous amounts of data. If we need to sort just a few hundred of items and/or the sorting doesn't occur very often, a simple algorithm does the job well, sometimes even faster due to a potential initial overhead of a very complex algorithm. So always consider the [KISS](kiss.md) approach first.
In our day to day lives we commonly get away with some of the simplest, uncomplicated sorting algorithms (such as [bubble sort](bubble_sort.md) or [insertion sort](insertion_sort.md)) anyway, unless we're programming a database or otherwise treating enormous amounts of [data](data.md). If we need to sort just a few hundred of items and/or the sorting doesn't occur very often, a simple algorithm does the job well, sometimes even faster due to a potential initial overhead of a very complex algorithm. So always consider the [KISS](kiss.md) approach first.
Attributes of sorting algorithms we're generally interested in are the following: