Sorting Algorithm Implementation In C Language And Javascript | letsbug.com
Sorting is a technique to rearrange the elements in ascending or descending order, which can be numerical, lexicographical, or any user-defined order. For example, consider a telephone directory which consists of four fields; phone number, name, address, pin code. So a large data is maintained in the form of records. If we want to search a phone number and name is is alphabetically sorted, then we can search easily. It would be very difficult if records were unsorted. Following are some of the sorting methods: Bubble sort Insertion sort Merge sort Quick Sort Selection Sort Assuming that you know some of programming, lets implement some of this algorithm below. Bubble sort In this sorting, method, the list is divided into two sub-lists sorted and unsorted. The smallest element is bubbled from unsorted sub-list. After moving the smallest element the imaginary wall moves one element ahead. Bubble sort In C language. ...