Secction 2.11. Exercise 2.39.

Post Reply
Older Dog
Site Admin
Posts: 26
Joined: Fri Nov 13, 2020 8:16 pm

Secction 2.11. Exercise 2.39.

Post by Older Dog »

An unsorted array of size n contains distinct integers between 1 and n + 1, with one element missing. Give an O(n) algorithm to find the missing integer, without using any extra space.
I assume that a sequence of consecutive integers is meant, and that by "one element" a member of this sequence is meant.
I don't quite get what is meant by "extra space." Is this supposed to be an extra array element?
Post Reply