Find Relative Complement of two Sorted ArraysWe will learn how to find the relative complement of two sorted arrays in this lesson. A sorted array is one that has been organised in a specified order (alphabetic, chronological, ordinal, cardinal order). An unsorted array is one that is not ordered in any way. Let us assume two sorted arrays: array1 and array2 of size p and q, respectively. We have to determine the relative complement of two arrays, array1 - array2, that indicates we have to locate all the elements in array1 but not in array2. Examples:
Implementation: C++ Program: Output: 6 12 15
|