Imagine having arrays:
arr1 -
[90, 44, 64, 16, 24, 20, 64, 86, 20, 64, 56, 72, 16]
along with
arr2 -
[21, 13, 9, 13, 15, 7, 17, 15, 9, 19, 7, 15, 9]
The goal is to implement insertion sort for these two arrays and obtain the sorted result array:
[
90, 86, 72, 64, 64, 64, 56, 44,
24, 21, 20, 20, 19, 17, 16, 16,
15, 15, 15, 13, 13, 9, 9, 9,
7, 7
]
I am aware that concatenating and sorting can work but might not be optimal in terms of performance.
If you have suggestions on how to achieve the above using ES6 features, please share!