Unlimited learning, half price | 50% off
Get 50% off unlimited learning

PerMallows (version 1.13)

insert: Insert operator

Description

Given a permutation and two positions i, j, move item in position i to position j

Usage

insert(perm, i, j)

Arguments

perm
a permutation
i
position of the permutation
j
position of the permutation

Value

The permutation in the input in which th eoperation has been applied

Examples

Run this code
insert(c(1,2,3,4,5),5,2)
insert(c(1,2,3,4,5),2,5)

Run the code above in your browser using DataLab