//+------------------------------------------------------------------+ //| sSortTest.mq5 | //| Integer | //| https://login.mql5.com/en/users/Integer | //+------------------------------------------------------------------+ #property copyright "Integer" #property link "https://login.mql5.com/en/users/Integer" #property version "1.00" //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { Alert("Start"); int Size=10000; double x0[]; double x1[]; ArrayResize(x0,Size); ArrayResize(x1,Size); long start; long t,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0; int Rounds=30; for(int j=0;j Pass "+IntegerToString(j+1)); for(int i=0;i Average:"); Alert("Bubble: "+IntegerToString(t1/Rounds)); Alert("Select: "+IntegerToString(t2/Rounds)); Alert("Insert: "+IntegerToString(t3/Rounds)); Alert("Shell: "+IntegerToString(t4/Rounds)); Alert("Hoare: "+IntegerToString(t5/Rounds)); Alert("SelectFst: "+IntegerToString(t6/Rounds)); Alert("Finish"); } //+------------------------------------------------------------------+ //| Checks if array is alrady sorted (ascending) | //+------------------------------------------------------------------+ void Check(double &aAr[]) { for(int i=ArraySize(aAr)-1;i>0;i--) { if(aAr[i]aLeft && xxxx)i++; while(j>aLeft && xx>aAr[j])j--; if(i<=j) { tmp=aAr[i]; aAr[i]=aAr[j]; aAr[j]=tmp; i++; j--; } } while(i<=j); if(aLeft=0 && tmp=0 && tmp>aAr[j];j-=g) { aAr[j+g]=aAr[j]; } aAr[j+g]=tmp; } } } //+------------------------------------------------------------------+ //| SortInsertUp | //+------------------------------------------------------------------+ void SortInsertUp(double &aAr[]) { double tmp; int i,j,Len=ArraySize(aAr); for(i=1;i=0 && tmp=0 && tmp>aAr[j];j--) { aAr[j+1]=aAr[j]; aAr[j]=tmp; } } } //+------------------------------------------------------------------+ //| SortSelectUp | //+------------------------------------------------------------------+ void SortSelectUp(double &aAr[]) { double tmp; int i,j,k; int Len=ArraySize(aAr); int Len1=Len-1; for(i=0;itmp) { k=j; tmp=aAr[j]; } } aAr[k]=aAr[i]; aAr[i]=tmp; } } //+------------------------------------------------------------------+ //| SortBubbleUp | //+------------------------------------------------------------------+ void SortBubbleUp(double &aAr[]) { double tmp; int i,j; int Len=ArraySize(aAr); int Len1=Len-1; for(i=1;i=i;j--) { if(aAr[j-1]>aAr[j]) { tmp=aAr[j-1]; aAr[j-1]=aAr[j]; aAr[j]=tmp; } } } } //+------------------------------------------------------------------+ //| SortBubbleDn | //+------------------------------------------------------------------+ void SortBubbleDn(double &aAr[]) { double tmp; int i,j; int Len=ArraySize(aAr); int Len1=Len-1; for(i=1;i=i;j--) { if(aAr[j-1]