JS Sort Algorithms

NameJS Sort Algorithms
AuthorPi Ke
TypeSource Code
Size1.48 KB
Date2011-07-29 10:54:00
Downloads18
TagSort,Algorithm,Quicksort,Mergesort,Inser

  ::Description

This source code is to implement five popular sorting algorithms with JavaScript. It will help us to understand not only different kinds of sorting algorithms but also the power of JavaScript.

The five sorting algorithms implemented are :

Quicksort : Quick sort algorithm. It is a very fast sorting algorithm for relative complex array but in small set of values, the advantage of quick sort will not be so obvious. The complexity is O(nlogn)

Insertion Sort : Insertion sort algorithm. It is to sort a set of values by inserting unsorted  elements into a sorted array.
It is much less efficient on large lists than more advanced algorithms such as quicksort. Complexity is \" in average

Selection sort : Selection sort algorithm. It is to sort a set of values by finding the minimum value first and put it in the appropriate position.
Complexity is \" in average

Merge sort : Merge sort algorithm. It is to sort a set of values by diving and conquering the array and finally merge the sorted array into a single array. Complexity is
\"\\mathcal{} in average

Bubble sort : Bubble sort algorithm. It is to sort  a set of values by putting the max or  min value to one end in one loop.
Complexity is \" in average

Hope you can learn something from this code.
 
   (Views : 4355 Downloads : 18 )

Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious

  ::User say

No comment for this article.

  ::Comment

Comment is disabled on this page