Question: Question 3: Given a non sorted array A of size n 2 that contains all the numbers 1 , 2 , 3 , . .

Question 3: Given a non sorted array A of size n 2 that contains all the numbers 1 , 2 , 3 , . . . , n except for two. Give an algorithm to find the two missing numbers. Use a constant extra space (namely apart from the array, only a constant number of variables). If this is hard for you use as much space as you want (you will loose some points but not too much).

Example of such array. For n = 13. The next array of 11 elements contains all the numbers from 1 to 13 but 7 and 11: < 12 , 6 , 1 , 8 , 4 , 9 , 12 , 3 , 5 , 13 , 2 > .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!