Hi,im currently trying to do insertion sort using 2 array and I've tried insertion sort using 1 array. The main idea for insertion sort using 2 array is to have an unsorted array, and then create another array that stores all numbers that have been sorted.
The algorithm for this code is like this, The element of array1(the unsorted array) will be inserted in array2 which initially is an array without any value. But, before the element in array1 gets to be inserted in array 2, it will check first at what position should the element(array1 element) be inserted in array2 in order to get a sorted array2. When it found its position in array2, then the element will be inserted and all elements in array2 will be a sorted element.
The algorithm for this code is like this, The element of array1(the unsorted array) will be inserted in array2 which initially is an array without any value. But, before the element in array1 gets to be inserted in array 2, it will check first at what position should the element(array1 element) be inserted in array2 in order to get a sorted array2. When it found its position in array2, then the element will be inserted and all elements in array2 will be a sorted element.
I'm guessing this is what you're asking for but this is probably the least efficient way to sort an array that I can possibly think of but here it is... https://onlinegdb.com/8l2HgnW7C
I can't copy the code for whatever reason... I wrote it but idk.
Yes!! @markyrocks thats exactly what im looking for..Thank you so much!! you helped me a lot!..and yeah i know that's its the least efficient but i somehow need to use this method:)