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
# variadic function call | |
""" | |
Note: | |
If a function is marked as isVariadic=true, then the last argument can occur one or more number of times. | |
Example: | |
FuncA: [String, Integer, Integer]; isVariadic = false | |
FuncB: [String, Integer]; isVariadic = true | |
FuncC: [Integer]; isVariadic = true | |
FuncD: [Integer, Integer]; isVariadic = true | |
FuncE: [Integer, Integer, Integer]; isVariadic = false |
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
""" | |
windowed k, v map | |
first version with t for debug | |
""" | |
class Node: | |
def __init__(self, time=0, val=0, key=0): | |
self.time = time | |
self.val = val | |
self.key = key | |
self.next = None |
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
""" | |
windowed k, v map | |
""" | |
import time | |
class Node: | |
def __init__(self, time=0, val=0, key=0): | |
self.time = time | |
self.val = val | |
self.key = key |
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
# delayed scheduler | |
""" | |
write a function schedule(task, delay) to schedule a task that will be run after some delay | |
(1) first normal version | |
(2) thread safe version | |
""" | |
import heapq | |
import time | |
class Task: | |
def __init__(self, name): |
OlderNewer