Its called stable sorting technique.
A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.
Some Sorting Algorithms are stable by nature, such as Bubble Sort, Insertion Sort, Merge Sort, Count Sort etc.
You can find the good explanation here https://www.geeksforgeeks.org/stability-in-sorting-algorithms/