Click here to Skip to main content
12,254,932 members (62,094 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
find number of inversions in array
Where array are randomly 1 to 100000 ????
Posted 31-Jan-13 20:17pm
Sant Osha1.6K
Comments
   
What is "randomly"? length? values? Who cares if it is random or not, the problem is the same.
Anyway, what did you try?
By the way, programming is not needed here, only some mathematics...
—SA
Sant Osha 1-Feb-13 2:59am
   
I'm new to it..... please, tell me your solution..
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I suspect Google won't be of any help in your case: "About 3,240,000 results"[^].
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

hi
if you want to make a number inverse then follow the follow the following code:
console.writeLine("Enter the position of the number for reverse :");
int no,rem,rev=0;
no= Console.ReadLine();
while(no!=0)
{
  rem=no%10;
  rev=rev*10+rem;
  no=no/10;
  
}

if you want to inversion of the array then use the following:
int count,no,j,i;
<data type=""> array[],temp[];
for(i=0;i<array.lenght;i++);>
for(j=0;i>=0,j<array.lenght;i--,j++)>
{
  temp[j]=array[i];
}
console.writeLine("your reverse array is:");
for(i=0;i<array.lenght;i++)>
{
 console.writeLine(temp[i]);
}
</data>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160426.1 | Last Updated 2 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100