use algorithmatic.com's in-browser integrated-development-environment here. The IDE offers syntax-highlighting, realtime validation, syntax-autocompletion, autocompletion for external-calls, interpreter and basic debugging.
Account
signin
algorithmatic.com uses OpenID - that means you don't need to register, probably you already have an OpenID, you just need to enable it. Click here to sign in
Insertion sort is a simple sorting algorithm, a comparison sort in which the sorted array (or list) is built one entry at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. However, insertion sort provides several advantages: simplicity of implementation, efficient for very small data sets or sets that are substantially sorted, uses constant memory, and is stable. Insertion Sort should be used when you have a small number of elements to sort or the elements in the initial collection are already "nearly sorted".
Performance: Best O(n), Average O(n^2), Worst O(n^2).
Wikipedia link: http://en.wikipedia.org/wiki/Insertion_sort