This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
with open(sys.argv[1]) as f: | |
s = f.read().strip() | |
floor = 0 | |
basement = False | |
for i, c in enumerate(s, start=1): | |
if c == '(': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from timeit import repeat | |
from math import log | |
from time import time | |
def estimate_big_o(fun): | |
timings = [] | |
data_length = 2**5 | |
while data_length <= 2**14: | |
seconds = repeat( | |
stmt='%s(%d)' % (fun.__name__, data_length), |