in reply to joining and sorting arrays
You could do this, which would be O(N): Run through
element in every array. For each one, you would do this:
Now, if the highest value you find isn't equal to your counter - 1 (subtract one because of the zero), you know you have a problem. And, if the total is not equal to the summation of 1 to your higest value, then you have a problem also. Otherwise, everything is correct.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: joining and sorting arrays
by tye (Sage) on Dec 04, 2001 at 23:41 UTC |