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
| def hashfn(item): | |
| h = hash(item) | |
| return (1 << (h%64)) | (1 << (h/64%64)) | |
| def mask(val): | |
| return bin(hashfn(val))[2:] | |
| class CountingBloom(object): | |
| def __init__(self): | |
| self.items = [0] * 64 |
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
| class Node(object): | |
| """ | |
| Tree node: left and right child + data which can be any object | |
| """ | |
| def __init__(self, data): | |
| """ | |
| Node Constructor | |
| @param data node data object | |
| """ | |
| self.left = 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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |