public static List <string> MergeSort(MergeInterface.IMergeSort grano, List <string> arreglo, int p, int r)
 {
     if (p < r)
     {
         int q = (p + r) / 2;
         arreglo = MergeSort(grano, arreglo, p, q);
         arreglo = MergeSort(grano, arreglo, q + 1, r);
         var temporal = grano.Merge(arreglo, p, q, r);
         temporal.Wait();
         arreglo = temporal.Result;
     }
     return(arreglo);
 }
Exemplo n.º 2
0
        public static List <string> MergeSort(Orleans.IClusterClient cliente, List <Guid> identificadores, int cantidad, MergeInterface.IMergeSort grano, List <string> arreglo, int p, int r)
        {
            var principal = cliente.GetGrain <MergeInterface.IMergeSort>(identificadores[contador]);

            if (contador == (identificadores.Count - 1))
            {
                contador = 0;
            }
            else
            {
                contador++;
            }

            if (p < r)
            {
                int q = (p + r) / 2;
                arreglo = MergeSort(cliente, identificadores, cantidad, principal, arreglo, p, q);
                arreglo = MergeSort(cliente, identificadores, cantidad, principal, arreglo, q + 1, r);
                var temporal = grano.Merge(arreglo, p, q, r);
                temporal.Wait();
                arreglo = temporal.Result;
            }
            return(arreglo);
        }