An inversion is an array of numbers is any pair (i,j) such
that i<j and A[i]>A[j]. What is the average number of
inversions in an array of n ?
distinct numbers?

Answers were Sorted based on User's Feedback



An inversion is an array of numbers is any pair (i,j) such that i<j and A[i]>A[j]. What is ..

Answer / narina thakur

The average number of inversions in an array of N distinct
elements is N(N-1)/4

Proof:
Total number of inversions in a list L and its reverse Lr
is N(N-1)/2. Average list has half this amount, N(N-1)/4.

Is This Answer Correct ?    15 Yes 6 No

An inversion is an array of numbers is any pair (i,j) such that i<j and A[i]>A[j]. What is ..

Answer / vivek sampara

How can you have the reverse of the list when it says i<j
and A[i]>A[j] ?

The Array always starts with A[0] till A[n] .

We cant have it reversed as A[n] to A[0].

The And the sequence of the total number of pairs are

n(n+1)/2

because the pairs are (n,n-1),(n,n-2),(n,n-3).....(n,0)
and (n-1,n-2),(n-1,n-3),(n-1,n-4)......,(n-1,0)
and (n-2,n-3),(n-2,n-4),(n-2,n-5)......,(n-2,0)


the list is n+(n-1)+(n-2)+.....3+2+1+0

reversing we'll get

1+2+3+4.....(n-1)+n =n(n+1)/2

So the average number of inversions are

(n(n+1)/2 )/n

= n(n+1)/2n

Is This Answer Correct ?    8 Yes 8 No

Post New Answer

More Engineering AllOther Interview Questions

which is your dream company and why?

2 Answers   Honeywell, IBM,


What is meant by relay & co-ordination at substation engineering ?

0 Answers   Bureau Veritas,


how the aeroplane protected from the lightening?

0 Answers   HEG,


Which of the following statements are true about constructors and methods? 1)A constructor has it's own name, a return type and is invoked using the new operator. 2)A function has it's own name, a return type and is invoked using the dot operator. 3)A constructor has the name of the class, no return type and is invoked using the new operator.

4 Answers   CSE,


WHAT THE DIFFERENCE BETWEEN JCB 3DX & 3D?

7 Answers   HCC, L&T,






sir i m reject two time in u.s in spring intake now im taking a date of 1july-2010 in fall intake &im competed my bachlor degree(chem) in jun-2009 so what answer i give to visa officer ask me a what r u doing last 1-year bcoz i have no work expirience

0 Answers  


if we give you the job AS A PETROLEUM ENGINEER WHAT WILL YOU DO(that is extraordinary) for our company

0 Answers   ONGC,


What is the allowable load carrying capacity of a circular column section of 400 mm diameter reinforced with 6x25 mm diameter bars adequately tied with spirals? Consider concrete of grade M25 and steel of grade Fe 415.

0 Answers  


How I can write a java program output the following 1+2+4+7+......N

0 Answers  


What is candidate key ? What is Alter net key ? & What is foreign key ?

0 Answers   Globsyn,


what is 3d gard

0 Answers   HP,


How we can read an Image in VC++?How we can find out the intensities of the pixels of an image and dimension of the image?

0 Answers   CEERI,


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4451)
  • Electrical Engineering Interview Questions Electrical Engineering (16632)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)