Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/07/2011, 09:49
josealfonso1
 
Fecha de Ingreso: diciembre-2007
Mensajes: 38
Antigüedad: 17 años, 2 meses
Puntos: 0
Pasar codigo de C# a PHP

Porfavor podrian pasarmelo a PHP, no es tan largo pero me harian un GRAN favor.
Pero no utilizen funciones nativas de php, sino solo codigo sencillo, porfavor haganlo aun mas sencillo que este codigo en C#,


yo no entiendo por ejemplo que hace el "while( bucket[i] )", si lo pueden remplazar por algo mas entendible.


Tampoco entiendo bucket[ ary[i] ]++, bucket[i]--;

tampoco entiendo int bucket[RANGE] = { 0 };


LO NECESITO EN PHP, SI ALGUIEN ME AYUDA ESTARE SUMAMENTE AGRADECIDO.
SI LO HACEN AUN MAS SENCILLO QUE ESTE CODIGO MUCHO MEJOR (NO UTILIZEN FUNCIONES DE PHP)



void bucketSort ( int ary[], int n )
{
int bucket[RANGE] = { 0 };
int i;
int j;

for( i = 0; i < n; i++ )
bucket[ ary[i] ]++;

j = 0;
for( i = 0; i < RANGE; i++ )
{
while( bucket[i] )
{
ary[j++] = i;
bucket[i]--;
}
}

return;
}