Skip to content

Instantly share code, notes, and snippets.

View MarksCode's full-sized avatar

Ron Marks MarksCode

View GitHub Profile
import string
import numpy as np
######## Begin code which needs to be modified ##########
# Implementation 1
class MyChainDict(object):
def __init__(self):
self.dictSize = 1000
self.mydict = []
for i in range(self.dictSize):
This project gave us interesting insights to hash table implementations and python in general. It showed us how important your implementation is when dealing with big data.
For chaining, we noticed that having a good hash function was really important to spread the entries over as many buckets as possible since otherwise searching would diverge from the O(1) expectation of a hash table. Similarily, even though each index of the hash array can hold more than one item doesn't mean you don't need a table resizing function if the load factor becomes too big.
For linear open adressing, the randomness of your input is very important since otherwise large clumps will form. When your load factor aproaches 1 it becomes very slow since you might have to iterate through many elements to find whether a key exists. Another bad thing is that deletion doesn't free up memory as you just have to mark the deleted bucket with a dumby value so searching for elements that are after it won't be an issue.
For quadratic open ad
// ==UserScript==
// @name TagPro Achievements
// @author Capernicus
// @version 1.0
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
// ==UserScript==
// @name AnyFlairs+
// @author Capernicus
// @version 1.0
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @include http://*oceanic*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
// ==UserScript==
// @name AnyFlairs+
// @author Capernicus
// @version 0.1
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @include http://*oceanic*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
// ==UserScript==
// @name AnyFlairs+
// @author Capernicus
// @version 0.1
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @include http://*oceanic*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
// ==UserScript==
// @name AnyFlairs+
// @author Capernicus
// @version 1.0
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @description Use and see others custom flairs
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
// ==UserScript==
// @name AnyFlairs+
// @author Capernicus
// @version 1.0
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function () {
// ==UserScript==
// @name AnyFlairs+
// @author Capernicus
// @version 1.0
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function () {
// ==UserScript==
// @name AnyFlairs+
// @author Capernicus
// @version 1.0
// @include http://*.koalabeast.com:*
// @include http://tagpro-*.koalabeast.com*
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function () {