EN-SP-8.12 Sorting algorihm
von Omid Hosseini
Task
Get information and take notes about bubble sort, selection sort and insertion sort and explain them to a non-expert in English on the basis of a card game.
You can use the following link:
Aim
- I can get information about the algorithmes (bubble sort, selection sort, insertion sort)
- I can explain the algorithmes to a non expert in english.
Self-evaluation
I completed the task easily without any bigger problems.
Algorithmes
Bubble sort:
- Bubble sort is a simple sorting algorithm.
- The input list is traversed from left to right.
- the current element is compared at each step to the right neighbor.
- Both elements are replaced if they violate the sort criteria.
- At the end of the phase is the largest or smallest element of the input end of the list in ascending or descending order.
- Is repeated until the entry bar is completely sorted.
Selection sort:
- Selection sort is an in-place comparison sort.
- It has O(n2) complexity.
- Selection sort is noted for its simplicity.
- also has performance advantages over more complicated algorithms in certain situations.
- The algorithm finds the minimum value, swaps it with the value in the first position
- repeats these steps for the remainder of the list.
- It does no more than n swaps, and thus is useful where swapping is very expensive.
Insertion sort:
- Insertion sort is a simple sorting algorithm.
- Is relatively efficient for small lists and mostly sorted lists.
- Is often used as part of more sophisticated algorithms.
- It works by taking elements from the list one by one and inserting them in their correct position into a new sorted list.
- In arrays, the new list and the remaining elements can share the array's space.
- Insertion is expensive.
- Requiring shifting all following elements over by one.
Card Game
One application for stable sorting algorithms is sorting a list using a primary and secondary key. For example, suppose we wish to sort a hand of cards such that the suits are in the order clubs (♣), diamonds (♦), hearts (♥), spades (♠), and within each suit, the cards are sorted by rank. This can be done by first sorting the cards by rank (using any sort), and then doing a stable sort by suit.
Profilinformation
- Land: Deutschland
- Vorname: Omid
- Nachname: Hosseini
- Stadt: Lohfelden
- E-Mail Adresse: omid.hosseini@web.de
Creative Commons Lizenz
![Creative-Commons-Lizenz](http://mahoodle.ovm-kassel.de/theme/raw/blocktype/creativecommons/static/images/by-sa-3_0.png)
EN-SP-8.12 Sorting algorihm von Omid Hosseini ist mit einer Creative Commons Namensnennung-Weitergabe unter gleichen Bedingungen 3.0 Unported 3.0 Unported Lizenz ausgestattet.
Jede der Bedingungen kann aufgehoben werden, sofern Sie die ausdrückliche Genehmigung von Omid Hosseini dazu erhalten.