# Programmer: Sriram Pemmaraju
# Date: April 7, 2015

import random
import time

start = time.time()
L = []
while len(L) < 50000:
    r = random.randint(1, 100000)
    if not r in L:
        L.append(r)
end = time.time()
print("The list-based implementation is slow and takes:", end-start, "seconds.")

start = time.time()
D = {}
while len(D) < 50000:
    r = random.randint(1, 100000)
    if not r in D:
        D[r] = 0
end = time.time()
print("The dictionary-based implementation is fast and takes:", end-start, "seconds.")
