Sorting AlgorithmsBy Bianca Lopez, Meg Schreck, ShantiMechery
What is A Sorting Algorithm Algorithm a precise rule (or set of rules) specifying how to solve some problem. Sorting Algorithm In computer science and mathematics, a sorting algorithm is an algorithm that puts elements of a list in a certain order.
Bubble Sort One of the earliest sorting algorithms (Was analyzed as early as 1950) Widely used as the first example of a sorting algorithm Is one of the simplest sorting algorithm One of the algorithms that takeslongest amount of time to sort Gets it name from the way smaller elements “bubble” to the top of the list. It is a comparison sort. (It compares each card individually with the card next to it)
Quicksort Quicksort is a widely used sorting algorithm invented by C. A. R. Hoare in 1960. It was invented for looking up words in the dictionary more efficient Its popularity has lasted since its invention because it’s easy to perform, is a “general purpose” sort, and has an efficient running time. One of the algorithms that takes the shortest amount of time to sort things with.
Examples Bubble Sort Explained With Height! Choose the first and second person to focus on. Switch them so the shorter person is on the left. Repeat for the second and third person. Keep going through the row, comparing the people’s height next to each other and switching them if needed. Do this until all of the people are sorted from shortest to tallest Quicksort Explained With Height! Choose a random person Choose another person. If it is taller than the original person you chose, he/she should be on the right of the original person. If the person is smaller compared to the person you chose, put it to the left. Do this until each person is on one side of the original person. Repeat the first 2 steps until all the people are in order from shortest to tallest.
Examples Selection Sort Explained Though Height! Put 5 people in a random line Look at two people at a time until you find the one with the shortest height Rearrange remaining people Repeat steps 2-3 until you have all of the people in order according to height Insertion Sort Explained Through Height! Put 5 people in a random line Choose one person in line to focus on Choose a new person and place it the right of the first person if it is shorter and left of the first if it is taller Repeat until everyone is in order according to height
Is it Efficient The efficiency of a sorting algorithm depends on the number of moves and comparisons. One of the most efficient sorting algorithms is Quicksort. One of the least efficient sorting algorithms is Bubble Sort.
Uses of Sorting Algorithms Used for converting data and for producing human-readable output Used for search algorithms when picking relevant results Sorting amounts of data in java and excel Companies and hospitals use Sorting Algorithms to sort records
Importance of Sorting Algorithms help you order elements that are in a list. order any list that could be used and they compare data that is sorted It is used to sort any data that is unordered or partially ordered Save time!
Thoughts on Sorting Algorithms It was worth learning Made order/sorting easier We now know how computers sort! We now know how to use computers to sort - good skill to know!