The possibility of swapping a value to a different value (absolute difference is two)
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
For example, the original vector is (2, 4, 1, 0).
After swapping, it can be (1, 0, 2, 4) or (0, 1, 4, 2).
The second outcome is what I want because every absolute value of the difference between the original values and the new values are equal to or more than 2, say|2-0|=2, |4-1|>2, |1-4|>2, |0-2|=2.
However, the first outcome is not what I want because for example |2-1|<2.
How to decide whether the original vector can be swapped to a new vector where every absolute value of the difference between the original values and the new values are equal to or more than 2?
Any suggestions? Many thanks.
probability combinatorics statistics optimization
add a comment |Â
up vote
0
down vote
favorite
For example, the original vector is (2, 4, 1, 0).
After swapping, it can be (1, 0, 2, 4) or (0, 1, 4, 2).
The second outcome is what I want because every absolute value of the difference between the original values and the new values are equal to or more than 2, say|2-0|=2, |4-1|>2, |1-4|>2, |0-2|=2.
However, the first outcome is not what I want because for example |2-1|<2.
How to decide whether the original vector can be swapped to a new vector where every absolute value of the difference between the original values and the new values are equal to or more than 2?
Any suggestions? Many thanks.
probability combinatorics statistics optimization
Any thoughts on the answer I posted yesterday?
â Gerry Myerson
yesterday
Earth to Orchard's, come in, please.
â Gerry Myerson
13 hours ago
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
For example, the original vector is (2, 4, 1, 0).
After swapping, it can be (1, 0, 2, 4) or (0, 1, 4, 2).
The second outcome is what I want because every absolute value of the difference between the original values and the new values are equal to or more than 2, say|2-0|=2, |4-1|>2, |1-4|>2, |0-2|=2.
However, the first outcome is not what I want because for example |2-1|<2.
How to decide whether the original vector can be swapped to a new vector where every absolute value of the difference between the original values and the new values are equal to or more than 2?
Any suggestions? Many thanks.
probability combinatorics statistics optimization
For example, the original vector is (2, 4, 1, 0).
After swapping, it can be (1, 0, 2, 4) or (0, 1, 4, 2).
The second outcome is what I want because every absolute value of the difference between the original values and the new values are equal to or more than 2, say|2-0|=2, |4-1|>2, |1-4|>2, |0-2|=2.
However, the first outcome is not what I want because for example |2-1|<2.
How to decide whether the original vector can be swapped to a new vector where every absolute value of the difference between the original values and the new values are equal to or more than 2?
Any suggestions? Many thanks.
probability combinatorics statistics optimization
asked 2 days ago
Orchard's Story
1
1
Any thoughts on the answer I posted yesterday?
â Gerry Myerson
yesterday
Earth to Orchard's, come in, please.
â Gerry Myerson
13 hours ago
add a comment |Â
Any thoughts on the answer I posted yesterday?
â Gerry Myerson
yesterday
Earth to Orchard's, come in, please.
â Gerry Myerson
13 hours ago
Any thoughts on the answer I posted yesterday?
â Gerry Myerson
yesterday
Any thoughts on the answer I posted yesterday?
â Gerry Myerson
yesterday
Earth to Orchard's, come in, please.
â Gerry Myerson
13 hours ago
Earth to Orchard's, come in, please.
â Gerry Myerson
13 hours ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
First, put your entries in increasing order, $a_1le a_2lecdotsle a_2n$. Then in your original vector swap $a_i$ with $a_n+i$ for each $i$. If that doesn't work, nothing will.
In your example, you go $0,1,2,4$, then swap $0$ with $2$, and $1$ with $4$ (as you did).
You have to fudge this a little, if your vector has an odd number of entries.
Hi, your approach seems good. What if the number of values is odd, say 1, 2, 3, 4, 5.
â Orchard's Story
12 hours ago
As I wrote, you have to fudge it a little. Why not think about it, and see whether you can figure out what to do? If you give it a go, but don't get anywhere, I'll come back to help.
â Gerry Myerson
5 hours ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
First, put your entries in increasing order, $a_1le a_2lecdotsle a_2n$. Then in your original vector swap $a_i$ with $a_n+i$ for each $i$. If that doesn't work, nothing will.
In your example, you go $0,1,2,4$, then swap $0$ with $2$, and $1$ with $4$ (as you did).
You have to fudge this a little, if your vector has an odd number of entries.
Hi, your approach seems good. What if the number of values is odd, say 1, 2, 3, 4, 5.
â Orchard's Story
12 hours ago
As I wrote, you have to fudge it a little. Why not think about it, and see whether you can figure out what to do? If you give it a go, but don't get anywhere, I'll come back to help.
â Gerry Myerson
5 hours ago
add a comment |Â
up vote
0
down vote
First, put your entries in increasing order, $a_1le a_2lecdotsle a_2n$. Then in your original vector swap $a_i$ with $a_n+i$ for each $i$. If that doesn't work, nothing will.
In your example, you go $0,1,2,4$, then swap $0$ with $2$, and $1$ with $4$ (as you did).
You have to fudge this a little, if your vector has an odd number of entries.
Hi, your approach seems good. What if the number of values is odd, say 1, 2, 3, 4, 5.
â Orchard's Story
12 hours ago
As I wrote, you have to fudge it a little. Why not think about it, and see whether you can figure out what to do? If you give it a go, but don't get anywhere, I'll come back to help.
â Gerry Myerson
5 hours ago
add a comment |Â
up vote
0
down vote
up vote
0
down vote
First, put your entries in increasing order, $a_1le a_2lecdotsle a_2n$. Then in your original vector swap $a_i$ with $a_n+i$ for each $i$. If that doesn't work, nothing will.
In your example, you go $0,1,2,4$, then swap $0$ with $2$, and $1$ with $4$ (as you did).
You have to fudge this a little, if your vector has an odd number of entries.
First, put your entries in increasing order, $a_1le a_2lecdotsle a_2n$. Then in your original vector swap $a_i$ with $a_n+i$ for each $i$. If that doesn't work, nothing will.
In your example, you go $0,1,2,4$, then swap $0$ with $2$, and $1$ with $4$ (as you did).
You have to fudge this a little, if your vector has an odd number of entries.
answered 2 days ago
Gerry Myerson
142k7142292
142k7142292
Hi, your approach seems good. What if the number of values is odd, say 1, 2, 3, 4, 5.
â Orchard's Story
12 hours ago
As I wrote, you have to fudge it a little. Why not think about it, and see whether you can figure out what to do? If you give it a go, but don't get anywhere, I'll come back to help.
â Gerry Myerson
5 hours ago
add a comment |Â
Hi, your approach seems good. What if the number of values is odd, say 1, 2, 3, 4, 5.
â Orchard's Story
12 hours ago
As I wrote, you have to fudge it a little. Why not think about it, and see whether you can figure out what to do? If you give it a go, but don't get anywhere, I'll come back to help.
â Gerry Myerson
5 hours ago
Hi, your approach seems good. What if the number of values is odd, say 1, 2, 3, 4, 5.
â Orchard's Story
12 hours ago
Hi, your approach seems good. What if the number of values is odd, say 1, 2, 3, 4, 5.
â Orchard's Story
12 hours ago
As I wrote, you have to fudge it a little. Why not think about it, and see whether you can figure out what to do? If you give it a go, but don't get anywhere, I'll come back to help.
â Gerry Myerson
5 hours ago
As I wrote, you have to fudge it a little. Why not think about it, and see whether you can figure out what to do? If you give it a go, but don't get anywhere, I'll come back to help.
â Gerry Myerson
5 hours ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2871758%2fthe-possibility-of-swapping-a-value-to-a-different-value-absolute-difference-is%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Any thoughts on the answer I posted yesterday?
â Gerry Myerson
yesterday
Earth to Orchard's, come in, please.
â Gerry Myerson
13 hours ago