• https://me.yahoo.com
COST (GBP)
0.84
0.00
0

# Unused Items

Reports the unused items in a partial permutation.
Controller: CodeCogs
Contents

C++

## Unknown

 std::vector unused_itemsunknown( int n int npart int* part )
Given a whole positive number $\inline&space;&space;n$, representing the size of the original permutation, a partial permutation $\inline&space;&space;\tau$ is one of size $\inline&space;&space;m&space;<&space;n$ that satisfies the following conditions:
$\tau&space;=&space;\left(&space;\begin{array}{cccc}&space;1&space;&&space;2&space;&&space;\ldots&space;&&space;m&space;\cr&space;\tau(1)&space;&&space;\tau(2)&space;&&space;\ldots&space;&&space;\tau(m)&space;\end{array}&space;\right)&space;\qquad&space;\tau(i)&space;\in&space;\{1,&space;2,&space;\ldots,&space;n&space;\}$
with
$\tau(i)&space;\neq&space;\tau(j),&space;\quad&space;\forall&space;i,&space;j&space;\in&space;\{&space;1,&space;2,&space;\ldots,&space;m&space;\},&space;\quad&space;i&space;\neq&space;j$

This function performs a linear search to find the unused items in the given partial permutation and returns them as a C++ vector object.

## References:

SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

### Example 1

#include <codecogs/maths/combinatorics/permutations/unused_items.h>
#include <iostream>
int main()
{
int alpha[5] = {1, 5, 2, 7, 9}, n = 10;
std::vector<int> result = Maths::Combinatorics::Permutations::unused_items(n, 5, alpha);
std::cout << "The unused values in the partial permutation Alpha are:";
std::cout << std::endl;
for (int i = 0; i < result.size(); i++)
std::cout << result[i] << " ";
std::cout << std::endl;
return 0;
}
Output:
The unused values in the partial permutation Alpha are:
3 4 6 8 10

### Returns

the unused items in the given partial permutation

### Authors

Lucian Bentea (August 2005)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.