The Relative Sort Algorithm is a specialized sorting technique designed to sort an array based on the order defined by a given reference array. This method is useful when you need to sort elements according to a custom order rather than the natural numerical or alphabetical order.
Example Input: list1 = ["a", "b", "c", "d", "e", "f", "g", "h", "i","j"] list2 = [0, 1, 1, 0, 1, 2, 2, 0, 1, 0]
Output: ['a', 'd', 'h', 'j', 'b', 'c', 'e', 'i', 'f', 'g']