selfcompiler's blog

By selfcompiler, 12 years ago, In English

ou are given an array B of n integers. Then the array A is created using array B as following : for each i (1 <= i <= n), we set Ai = Bi + d with the probability Pi, otherwise Ai = Bi. find the expect number of swaps that bubble sorting will make when the array A is sorted .......

for example if input is this n=4 d=7 elements of array B = 5 6 1 7 probability of array of elements B = 25 74 47 99\ answer=1.6049

  • Vote: I like it
  • -45
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +12 Vote: I do not like it

Admins .. please remove this post .. this's the solution to a problem from july challenge in codechef!!

»
12 years ago, # |
  Vote: I like it +8 Vote: I do not like it

This is not even his code... He copied it from fushar's blog.