This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
void inssort(vector<int> &a){ | |
int n = a.size(); | |
for(int j=1; j<n; j++){ | |
int x = a[j]; | |
int k=j; | |
while(--k>=0 && x<a[k]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
using namespace std; | |
/* | |
Funcion que dado un mapa permutativo cuenta cuantos ciclos tiene. | |
Ejemplo: | |
Suponiendo el mapa siguiente: | |
M[1] = 2; | |
M[2] = 4; | |
M[3] = 6; |