# Difference between revisions of "Talk:TADM2E 3.11"

From Algorithm Wiki

Brownslink (Talk | contribs) (Space requirement really O(n**2)) |
SriPrasanna (Talk | contribs) |
||

Line 1: | Line 1: | ||

For the answer given in part 2, the space required seems to be the sum from 1 to n of n which is n(n+1)/2. This gives O(n**2) for space requirements. Doesn't it? | For the answer given in part 2, the space required seems to be the sum from 1 to n of n which is n(n+1)/2. This gives O(n**2) for space requirements. Doesn't it? | ||

+ | |||

+ | |||

+ | Why cant we just sort the input (array)? Will this not mean the smallest number between x and y is always x? |

## Revision as of 00:01, 6 April 2015

For the answer given in part 2, the space required seems to be the sum from 1 to n of n which is n(n+1)/2. This gives O(n**2) for space requirements. Doesn't it?

Why cant we just sort the input (array)? Will this not mean the smallest number between x and y is always x?