Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Quinston Pimenta graphoarty

🎯
Focusing
Block or report user

Report or block graphoarty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:cf05841cef69dacc32d881eb44a2d619
from hashlib import md5
from DataStructures.LinkedList.LinkedList import *
View gist:65ffad3a8bd6c5359f616cd80e4c44dd
# @param {number} hashTableSize
def __init__(self, hashTableSize = defaultHashTableSize):
# Should probably be named HashTableEntry. You get the point.
self.buckets = [LinkedList() for x in range(0, hashTableSize)]
# A quick lookup for has() and getKeys().
self.keys = {}
View gist:e4509b485a9f43a5ddcf84052d8a917d
# @params {string} key
# @returns {number}
def hash(self, key):
k = 0
for s in list(md5(str(key).encode('utf-8')).hexdigest()):
k += ord(s)
return k % len(self.buckets)
View gist:f3b681b60c4be5efecd3111237b79954
# @param {string} key
# @param {*} value
def set(self, key, value):
keyHash = self.hash(key)
self.keys[key] = keyHash
bucketLinkedList = self.buckets[keyHash]
# custom linkedlist find
node = None
View gist:d7769add0b76b051844f82ec068e5a88
# @param {string} key
# @returns {*}
def get(self, key):
bucketLinkedList = self.buckets[self.hash(key)]
# custom linkedlist find
currentNode = bucketLinkedList.head
while not currentNode == None:
for k in currentNode.value:
View gist:441023897015ad548ed239e7974cf2e1
# @params {string} key
# @returns {boolean}
def has(self, key):
if key in self.keys.keys():
return True
else:
return False
# @returns {string[]}
def getKeys(self):
@graphoarty
graphoarty / asyncScript.js
Created Feb 20, 2019
Import Asynchronous (async) JavaScript (js) Script in Reactjs
View asyncScript.js
// Example Call
// asyncScript('https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js');
asyncScript = (scriptPath) => {
const script = document.createElement('script');
script.src = scriptPath;
script.async = true;
document.body.appendChild(script);
@graphoarty
graphoarty / da.java
Created Feb 21, 2019
Dijkstra's Algorithm
View da.java
import java.util.Scanner; //Scanner Function to take in the Input Values
public class Dijkstra {
static Scanner scan; // scan is a Scanner Object
public static void main(String[] args){
int[] preD = new int[5];
int min = 999, nextNode = 0; // min holds the minimum value, nextNode holds the value for the next node.
You can’t perform that action at this time.