Dwylkz's blog

By Dwylkz, 11 years ago, In English
  1. There are n! kinds of paths, ie. n * n! pairs.
  2. For each ai there are (n - 1)! times being the last one(appear once), And n! - (n - 1)! times appear twice,
  3. Thus a number ai appear 2 * (n! - (n - 1)!) + (n - 1)! = 2 * n! - (n - 1)! times.
  4. Realize that among all paths, except for the first row, ie. |0 - ai|, each pair appears (n * n! - (n - 1)!) / C(n, 2) = 2 * (n - 1)! times.
  5. Assume that the squence is sorted in ascending order. has i elements less than it. Hence, include the first row it has i * 2 * (n - 1)! + (n - 1)! = (2 * i + 1) * (n - 1)! times to be positive, and has 2 * n! - (n - 1)! - (2 * i + 1)(n - 1)! = 2 * n! - (2 * i + 2) * (n - 1)! to be negative.
  6. Thus, for each ai, include 1st row, the sum of it in all paths is
ai * ((i * 2 + 1)(n - 1)! - (2 * n! - (2 * i + 2) * (n - 1)!)) = ai * ((4 * i + 3) * (n - 1)! - 2 * n!)

7, Average for ai's sum is

  1. Finnally, we got the result:

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it