Click here to Skip to main content
11,505,486 members (65,490 online)
Rate this: bad
good
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
Sergey Alexandrovich Kryukov at 1-Feb-13 2:32am
   
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 at 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
0 Sergey Alexandrovich Kryukov 552
1 F-ES Sitecore 380
2 Richard Deeming 270
3 CHill60 235
4 Richard MacCutchan 230
0 Sergey Alexandrovich Kryukov 1,067
1 Maciej Los 575
2 Peter Leow 540
3 F-ES Sitecore 525
4 DamithSL 470


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 2 Feb 2013
Copyright © CodeProject, 1999-2015
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