-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcapacity.py
34 lines (31 loc) · 995 Bytes
/
capacity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import time
while True:
#set size of array to measure
length = int(input("input data size : "))
data = []
for i in range (0, length):
data.append(0)
limit = []
for i in range (0, length):
limit.append(1)
#loop through posibilities
number = 0
starttime = time.time()
while data != limit:
flag = True
counter = len(data)-1
print (number, hex(number), data, time.time()-starttime)
number += 1
while flag == True:
if data[counter] == 0:
data[counter] = 1
flag = False
else:
data[counter] = 0
counter -= 1
if counter < 0:
break
print (number, hex(number), data)
print ()
print(time.time() - starttime, "secs for size", length, "array")
print()