[algogeeks] Re: unique number in an array

2010-06-14 Thread asit
Let's assume array contains only +ve numbers and maximum number is MAXNUM Take an array arr[MAXNUM] for(i=1; i<=MAXNUM; i++) arr[i]=0; for(i=1; i<=MAXNUM; i++) arr[a[i]]++; now print the indexes whose array value is 1 -- You received this message because you are subscribed to the G

Re: [algogeeks] Re: unique number in an array

2010-06-14 Thread BALARUKESH SIVARAMAN
sort the input and then compare each element i with its adjacent neighbors ie., i-1 and i+1 if both are different then that element is the unique one... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algo

[algogeeks] Re: OS doubt

2010-06-14 Thread asit
On Jun 12, 1:22 pm, amit wrote: > OS doubt: > > I have read many times that say a 24 KB process enters the Main Memory > selected by the Long Term Scheduler. > But I don't understand what it exactly means. > As far as I know Process consists of ( Code + Data(Static) + > Stack(Local Data) + Heap)

[algogeeks] Re: unique number in an array

2010-06-14 Thread kunzmilan
Write the array as a vector string S, eg (1,0,0,0...) (0,0,1,0...) (0,0,0,1...) etc. Find the quadratic form S^T.S. On its diagonal, occurences of all numbers are counted. kunzmilan On 13 čvn, 20:44, jalaj jaiswal wrote: > give an algo to find a unique number in an array > > for eg a[]={1,3,4,1,