# data[].attributes.headline
Visualization and Comparison of Sorting Algorithms

# data[].attributes.subject
Visualization and Comparison of Sorting Algorithms

# data[].attributes.attachment_link.title
Visualization and Comparison of Sorting Algorithms

# data[].attributes.attachment_link.entities[].name
Hungarian Scouts Folk Ensemble Czardas Dance

# data[].attributes.attachment_link.title
Merge-sort with Transylvanian-saxon (German) folk dance

# data[].attributes.attachment_link.description
Created at Sapientia University, Tirgu Mures (Marosvásárhely), Romania. Directed by Kátai Zoltán and Tóth László. In cooperation with "Maros Művészegyüttes", Tirgu Mures (Marosvásárhely), Romania. Choreographer: Füzesi Albert. Video: Lőrinc Lajos, Körmöcki Zoltán. Supported by "Szülőföld Alap", MITIS (NGO) and evoline company.

# data[].attributes.attachment_link.title
Quick-sort with Hungarian (Küküllőmenti legényes) folk dance

# data[].attributes.attachment_link.readable_text
#include <stdlib.h>
#include <time.h>
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
	// DICHIARAZIONE VARIABILI
	int i, j, temp, indice, jMin;
    int N=10000; // dimensione ARRAY
	clock_t start, end;
    double tempo;
    // DICHIARAZIONE ARRAY
	int arr[N];

    //raccolta timestamp tempo partenza programma
    start=clock();
    
    // Riempiento con valori pseudocasuali ARRAY
    srand(time(NULL));
    for (indice=0; indice<N; indice++) arr[indice]=rand();
    
	//stampa vettore
    cout<<"vettore iniziale............."<<endl;
    for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
    cout<<endl;

	// CORPO PROGRAMA
    for (i=0; i<N-1; i++)
    {
        jMin = i;
        for (j=i+1; j<N; j++)
        {
            if (arr[j] < arr[jMin])
            {
               jMin = j;
            }
        }
        temp = arr[jMin];
        arr[jMin] = arr[i];
        arr[i] = temp;
    }
    //stampa vettore ordinato
    cout<<"vettore Ordinato............."<<endl;
    for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
    cout<<endl;
    
    //raccolta timestamp tempo fine programma
    end=clock();
    tempo=((double)(end-start))/CLOCKS_PER_SEC;
    cout<<endl<<"DURATA = "<<tempo<<" sec";

	system("PAUSE");
	return 0;
}

# data[].attributes.attachment_link.readable_text
#include<stdlib.h>
#include<time.h>
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
	// DICHIARAZIONE VARIABILI
	int i, j, k, indice, ordinato, N=10;
	int scambio = 0;
	// DICHIARAZIONE-costruzione ARRAY
	int arr[] = {3, 0, 1, 8, 7, 2, 5, 4, 9, 6};

    //stampa vettore
    cout<<"vettore iniziale"<<endl;
    for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
    cout<<endl;

	for (i=1; i <N; i++)
	{
	    for (j=i; j>0 && arr[j]<arr[j-1]; j--)
	    {
		    cout<<"i="<<i<<" j="<<j<<endl;
			if(arr[j] < arr[j-1])
			{
            	scambio = arr[j];
            	arr[j] = arr[j-1];
            	arr[j-1] = scambio;
            	
            	//stampa vettore
				cout<<"SCAMBIO j="<<j<<" j-1="<<j-1<<"   vettore scambiato = ";
        		for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
        		cout<<endl;
         	}
        }
	}

  
    //stampa vettore
    cout<<"i="<<i<<"j="<<j<<" vettore=";
    for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
    cout<<endl;
    

    system("PAUSE");
	return 0;
}

# data[].attributes.attachment_link.title
Bubble-sort with Hungarian ("Csángó") folk dance

# data[].attributes.attachment_link.readable_text
#include<stdlib.h>
#include<time.h>
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
	// DICHIARAZIONE VARIABILI
	int i, j, k, indice, ordinato, N=10;
	int scambio = 0;
	// DICHIARAZIONE-costruzione ARRAY
	int arr[] = {3, 0, 1, 8, 7, 2, 5, 4, 9, 6};

    //stampa vettore
    cout<<"vettore iniziale"<<endl;
    for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
    cout<<endl;

    //Ordinamento
    for (i = 0; i < (N-1); i++)
    {
        ordinato=0;
        for (j = 0; j < N-1-i; j++)
        {
            cout<<"i="<<i<<" j="<<j<<" ordinato="<<ordinato<<endl;
			if (arr[j] > arr[j+1]) //Se il numero della posizione attuale e' maggiore del successivo scambio i valori
            {
                scambio = arr[j+1];
                arr[j+1] = arr[j];
                arr[j] = scambio;
                ordinato=1;
                
                //stampa vettore
				cout<<"SCAMBIO j="<<j<<" j+1="<<j+1<<"   vettore = ";
        		for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
        		cout<<endl;
            }
        }
        if (ordinato==0) i=N;
        
        //stampa vettore
        cout<<"i="<<i<<"j="<<j<<" vettore=";
        for (indice=0; indice<N; indice++) cout<<arr[indice]<<" ";
        cout<<endl;
    }

    system("PAUSE");
	return 0;
}
