SUMA PRAM CREW
#Moreno Fonseca Luis Felipe
import threading
import math
# Hilo
def hilo(i,j):
a[j]=a[j]+a[j-pow(2,i-1)]
print a
#Principal
print '\t\t--------- SUMA CREW --------'
a=[]
x=int(raw_input("Define el Tamaño del Vector -> "))
i=1
while (i<=x):
n=int(raw_input("Ingresa Valor -> "))
a.append(n)
print a
i+=1
n1=len(a)
lg=int(math.log(n1))
for i in range(1,lg):
for j in range((pow(2,i-1)+1),n1):
h = threading.Thread(target=hilo,args=(i,j))
h.start()
h.join()
print i,j
print a
No hay comentarios:
Publicar un comentario