A simple algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.
Selection Sort:
This algorithm repeatedly finds the minimum element (from the unsorted part of the array) and puts it at the beginning of the unsorted part.
Insertion Sort:
Builds the final sorted array one item at a time. It iterates through the input elements and builds a sorted list by inserting each element into its correct position in the already sorted part of the array.
Merge Sort:
A divide-and-conquer algorithm that divides the unsorted list into n sublists, each containing one element (a list of one element is considered sorted). Then, it repeatedly merges sublists to produce new sorted sublists until there is only one sublist remaining.
Quick Sort (Manual Implementation):
While qsort() uses quicksort, you can also implement it manually. It picks an element as a pivot and partitions the array around the pivot, such that elements smaller than the pivot are on one side and elements larger than the pivot are on the other. It then recursively sorts the two sub-arrays.