kyh / sorting-algorithms

Sorting algorithms in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sorting Algorithms

Build Status

Sorting algorithms implemented in Javascript

References:

Bubble sort

Bubble sort is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order.

Insertion sort

Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time.

Selection sort

Selection sort is the most conceptually simple of all the sorting algorithms. It works by selecting the smallest (or largest, if you want to sort from big to small) element of the array and placing it at the head of the array. Then the process is repeated for the remainder of the array; the next largest element is selected and put into the next slot, and so on down the line.

Merge sort

The idea behind merge sort is to split the collection into smaller groups by halving it until the groups only have one element or no elements (which are both entirely sorted groups). Then merge the groups back together so that their elements are in order.

Quicksort

Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the sub-arrays.

About

Sorting algorithms in JavaScript


Languages

Language:JavaScript 100.0%