Sorting algorithms are divided into two categories based on the space they use and the stability of the algorithms. Based on stability, algorithms can further be classified into stable or unstable.  Stable sorting is the term for a sorting algorithm that does not alter the order in which related pieces of content appear after the content has been sorted. Consider an array with the repeating element "22," where the first instance is stored at memory address "x0001" and the second instance is placed at location "x0002" in the memory. The element "22" will preserve this order in stable sorting, meaning that the first instance of 22 in the sorted array is the one that occupied location "x0001," and the second instance is at position "x0002." In this case, memory is only being taken into account to discriminate between these two items that share the same value.  On the other hand, a sorting algorithm is said to be unstable if, after sorting the content, it changes the order in which related content appears. Therefore, if we use the same array, sorting will place the element "22" at position "x0002" ahead of the similar element at position "x0001" in the sequence.