| Share this post! | Vote this! |
|
Have an array you need to put in order? Keeping business records and
want to sort them by ID number or last name of client? Then you'll need
a sorting algorithm. To understand the more complex and efficient
sorting algorithms, it's important to first understand the simpler, but
slower algorithms. In this article, you'll learn about bubble sort,
including a modified bubble sort that's slightly more efficient;
insertion sort; and selection sort. Any of these sorting algorithms are
good enough for most small tasks, though if you were going to process a
large amount of data, you would want to choose one of the sorting
algorithms listed on the advanced sorting page.
FURTHER READING
Selection sort and Insertion sort
Heap Sort
Merge Sort
Quicksort
Radix Sort a special case sorting algorithm
Bubble sort
The simplest sorting algorithm is bubble sort. The bubble sort works by iterating down an array to be sorted from the first element to the last, comparing each pair of elements and switching their positions if necessary. This process is repeated as many times as necessary, until the array is sorted. Since the worst case scenario is that the array is in reverse order, and that the first element in sorted array is the last element in the starting array, the most exchanges that will be necessary is equal to the length of the array. Here is a simple example: more...FURTHER READING
Selection sort and Insertion sort
Heap Sort
Merge Sort
Quicksort
Radix Sort a special case sorting algorithm




0 comments:
Post a Comment