SuccessFactors Interview Question: There is Array A of size N, I... | Glassdoor

Interview Question

Senior Software Engineer Interview Bengaluru (India)

There is Array A of size N, It has unsorted random int

  values. There is a Array B of size 2N, it has Sorted int values in first N locations, and the last N positions are empty. Write a program to copy all elements from first Array A into second Array B, such that the resulting Array B is Sorted. What is the complexity of solution you offered (Big O Notation)

Interview Answer

1 Answer


Keep copying elements from Array A to Array B, and then moving elements around in Array B.(OR Try using a third Array C of size 2N to hold values).

It is easy to solve, but what is the best solution?

Interview Candidate on Oct 1, 2010

Add Answers or Comments

To comment on this, Sign In or Sign Up.