3. Merging two sorted arrays #

Created Wednesday 11 December 2019

Algorithm

  1. Start i=0, j=0. Make an array of length n1 + n2.
  2. Run a while loop, with condition i<n1 and j<n2. Copy to the result array.
  3. When the loop exits, declare (p and t-size = of the unfinished array, i.e n1 or n2) assign it to the unfinished array.
  4. Run a while loop(t<n1 or n2){p++}, easy done. No need to count. t was needed for anchor, i.e from where to resume).

Traversal was done directly by using pointer.