@Adarsh
fails on this
a[] = {2,2,2,6,6,6}

On Sat, Jun 25, 2011 at 10:54 AM, Adarsh <s.adars...@gmail.com> wrote:

> int n = A.size();
> for (int i=0; i<n; i++)
>    total += A[i];
> findMinMax(A[1...n]);
>
> int mean = (max+min)/2;
> if ((total - n*mean) == 0)
>    printf("consecutive\n");
> else
>    printf("not consecutive\n");
>
>
> findMixMax() ... this can be done in O(n)
> so, total time complexity ... O(n)
>
> works for negative numbers also.... if there is any mistake ... let me
> know
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to