Info-1.docx

  • Uploaded by: SerenaBlaga
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Info-1.docx as PDF for free.

More details

  • Words: 199
  • Pages: 2
PERMUTARI

ARANJAMENTE

COMBINARI

#include using namespace std; int n,s[100]; int verif (int i, int j) { int k; for(k=1;kn) { for(k=1;k<=n;k++) cout<<s[k]<<" "; cout<<endl; } else { for(j=1;j<=n;j++) if(verif(i,j)) { s[i]=j; permutari(i+1); } } } int main() { cin>>n; permutari(1); return 0; }

#include using namespace std; int n,m,s[100]; int verif (int i, int j) { int k; for(k=1;km) { for(k=1;k<=m;k++) cout<<s[k]<<" "; cout<<endl; } else { for(j=1;j<=n;j++) if(verif(i,j)) { s[i]=j; aranjamente(i+1); } } } int main() { cin>>n>>m; aranjamente(1); return 0; }

#include using namespace std; int n,m,s[100]; void combinari (int i) { int k,j; if(i>m) { for(k=1;k<=m;k++) cout<<s[k]<<" "; cout<<endl; } else { for(j=s[i-1]+1;j<=n;j++) { s[i]=j; combinari(i+1); } } } int main() { cin>>n>>m; combinari(1); return 0; }

SUBMULTIMI #include using namespace std; int n,s[20]; void submultimi (int i) { int k,j; for(j=s[i-1]+1;j<=n;j++) { s[i]=j; for(k=1;k<=i;k++) cout<<s[k]<<" "; cout<<endl; submultimi(i+1); } } int main() { cin>>n; submultimi(1); return 0; } Exemplu: *date de intrare n=3 *date de iesire 1 12 123 13 2 23 3

More Documents from "SerenaBlaga"

Cautarebinara_aplicatii.pdf
November 2019 3
Algelementari.docx
June 2020 2
Info-1.docx
June 2020 5
Eficienta.docx
June 2020 5
Tema 7.docx
November 2019 3