The possibility of swapping a value to a different value (absolute difference is two)

The name of the pictureThe name of the pictureThe name of the pictureClash 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.







share|cite|improve this question



















  • Any thoughts on the answer I posted yesterday?
    – Gerry Myerson
    yesterday










  • Earth to Orchard's, come in, please.
    – Gerry Myerson
    13 hours ago














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.







share|cite|improve this question



















  • Any thoughts on the answer I posted yesterday?
    – Gerry Myerson
    yesterday










  • Earth to Orchard's, come in, please.
    – Gerry Myerson
    13 hours ago












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.







share|cite|improve this question











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.









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









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
















  • 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










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.






share|cite|improve this answer





















  • 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










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















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






























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.






share|cite|improve this answer





















  • 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














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.






share|cite|improve this answer





















  • 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












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.






share|cite|improve this answer













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.







share|cite|improve this answer













share|cite|improve this answer



share|cite|improve this answer











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
















  • 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












 

draft saved


draft discarded


























 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?

What is the equation of a 3D cone with generalised tilt?