Pergunta de entrevista da empresa Trifacta

merge 2 arrays into the sorted one

Resposta da entrevista

Sigiloso

6 de nov. de 2018

First approach 1. We can start by merging the two arrays and let it be unsorted at first 2. Use quicksort on the output array Second approach 1. Sort the two arrays separately 2. compare the last element of first array to first element of second array, if second 0 elem is less than first nth elem then merge it directly 3. else compare last elem to first elem of first array to first elem to last elem of second array NOTE: I prefer first approach: it may give sorted array at first but we can sort later Second approach is complicated and computationally more expensive but the output will be just the sorted array. You should consider that it will do comparisons (More Actually) so why not consider less expensive method