so I have two arrays - arrOne = [10, 2, 3, 14, 1] and arrTwo = [1, 2, 3, 5, 4];
I want sort the arrTwo and use the same indexing changes on arrOne, ie arrTwo = [1, 2, 3, 4, 5], arrOne [10, 2, 3, 1, 14].
I've been trying to implement it with merge sort, but it does not work. The recursion obstructs me from doing what I intended.
Important to note, I am getting the data as two integers at a time and push them into separate arrays, using the previous arrays that would mean -
- input 10 ,1
- input 2, 2
- input 3, 3
- input 14, 5
- input 1, 4
Perhaps a different data structure could be used, but I am not aware of it.
I have put go as a tag since I would like to solve it both languages.