plz help me with turbosort

plz explain me how i should do turbosort question as my compiler shows windows explorer has stopped working
when i write int a[1000000] and compile the code…also tell me what strategy should i perform to do the question

declare array as static int.

For Example:


static int arr[1000000];

You may refer to my code: http://www.codechef.com/viewsolution/5204230

declare the array globally i.e. outside main().

Use algorithms like quicksort or mergesort to sort the array.

use stl for sorting in c++ and declare array globally.
Also you can use vector as it can take 10^6 elements.

You may globally declare the array befor ur main functions…See it helps. Strategy is simple to understand. Sav e every input in array index by incrementing it by 1.(initial array should be a[i]=0)
Say input is 5 then do a[5]=a[5]+1;i.e. 1
say input is again 5 do a[5]=a[5]+1 i.e. 2. Then start from 1 and check if a[i]!=0 then,
1<=i<=1000000
while(a[i]!=0)
{
print(a[i]) --a[i];
}