Message Boards Message Boards

0
|
38 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

upper bound of swaps between p_i and p_{i+1}?

Posted 15 hours ago

You are given a permutation p, initially n,n-1,...,1.

At each step you can choose an adjacent inverse pair and swap them, until the permutation is sorted in increasing order.

For each 1<=i<=n-1, how many times will you swap p[i] and p[i+1]? Is there an upper bound?

I guess it's O(n), but I can't find a proof or counter-example.

POSTED BY: Netro Neko
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract