Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/07/2010, 18:12
Avatar de xalupeao
xalupeao
 
Fecha de Ingreso: mayo-2008
Ubicación: Santiago, Chile
Mensajes: 749
Antigüedad: 16 años
Puntos: 12
Ayuda con algoritmo de a-z

Bueno amigos les planteo el problema.

Necesito recorrer de a-z de la siguiente forma


Código:
abc => "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-"

a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
w
y
z

aa
ab
ac
ad
ae
af
ag
ah
ai
aj
ak
al
am
an
ao
ap
aq
ar
as
at
au
aw
ay
az

aa[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ab[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ac[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ad[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ae[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
af[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ag[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ah[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ai[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
aj[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ak[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
al[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
am[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
an[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ao[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ap[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
aq[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ar[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
as[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
at[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
au[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
aw[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
ay[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]
az[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,y,z,-]

y al terminar esto siga asi

ba
bb
bc
bd
be
bf
bg
bh
bi
bj
bk
bl
bm
bn
bo
bp
bq
br
bs
bt
bu
bw
by
bz

................ y asi con todas las letras.

¿se entiende mas o menos lo que quiero generar?

-------------------
Tengo este codigo que acabo de hacer pero solo llego a las 2 parte.
--------------------

Código PHP:
Ver original
  1. <?php
  2.  
  3.     $largo = 34;
  4.     $switch=true;
  5.     $ready=true;
  6.     $x=0;
  7.     $abc = array(0,1,3,4,5,6,7,8,9,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z','-');
  8.     while($switch){
  9.         if($ready){
  10.             for($i=0;$i<=$largo;$i++){
  11.             print $abc[$i].'<br />'; flush();
  12.             }
  13.         }
  14.         $ready=false;
  15.         for($i=0;$i<=$largo;$i++){
  16.         print $abc[$x].$abc[$i].'<br />'; flush();
  17.         }
  18.         $x++;
  19.         if($x > 34){
  20.             $switch=false;
  21.         }
  22.     }
  23. ?>
__________________
Hosting en Chile en Silverhost - La solución en Hosting en Chile.

Última edición por xalupeao; 25/07/2010 a las 18:33