Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started