KeenTween
  • Home
  • Inspire her
  • Phenom
  • STEM
  • Gender
  • FUN
  • summer fun
  • Then & Now
  • Empathy
  • About

what is algorithm? examples of sorting algorithm..


In computer science and math a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most used orders are numerical order and lexicographical order. Efficient sorting is important to optimizing the use of other algorithms (such as search and merge algorithms) that require sorted lists to work correctly.
Bucket Sort: 
Suppose we need to sort an array of positive integers {3,11,2,9,1,5}. A bucket sort works as follows: create an array of size 11. Then, go through the input array and place integer 3 into a second array at index 3, integer 11 at index 11 and so on. We will end up with a sorted list in the second array.

Bubble Sort:
The algorithm works by comparing each item in the list with the item next to it, and swapping them if required. In other words, the largest element has bubbled to the top of the array. The algorithm repeats this process until it makes a pass all the way through the list without swapping any items.

Why not Bubble Sort?
​

The bubble sort compares adjacent items and swaps them if they are out of order. During each pass, until the array is sorted, the algorithm traverses through the data and compares adjacent items, swapping them if they are not in ascending order. It is simple to understand and implement. However, this sort requires several passes over the data, and thus introduces a major factor of inefficiency.

Selection Sort:

The algorithm works by selecting the smallest unsorted item and then swapping it with the item in the next position to be filled. The selection sort works as follows: you look through the entire array for the smallest element, once you find it you swap it (the smallest element) with the first element of the array.

Then you look for the smallest element in the remaining array (an array without the first element) and swap it with the second element. Then you look for the smallest element in the remaining array (an array without first and second elements) and swap it with the third element, and so on.


Visualization and comparison of 9 different sorting algorithms:

- selection sort
- shell sort
- insertion sort
- merge sort
- quick sort
- heap sort
- bubble sort
- comb sort
- cocktail sort







Visualization and comparison of 9 different sorting algorithms:

- selection sort
- shell sort
- insertion sort
- merge sort
- quick sort
- heap sort
- bubble sort
- comb sort
- cocktail sort

1 of 5: what is an algorithm?


2  of 5: The most efficient way to sort a million 32 bit integers:


3 of 5:  The most efficient way to sort a million 32 bit integers:


4  of 5::  Select-sort (explained with Gypsy folk dance): 

Sapientia University, TirguMures,  Romania


5 of 5 ::  Visualization and Comparison of Sorting Algorithms


.

Science

Technology

Engineering

Mathematics

Empowerment

  • Home
  • Inspire her
  • Phenom
  • STEM
  • Gender
  • FUN
  • summer fun
  • Then & Now
  • Empathy
  • About