Skip to content

Instantly share code, notes, and snippets.

@beriomind
beriomind / collision-handling.py
Created April 18, 2026 18:35
Collision Handling In Hash Table - Python Implementation
class HashTable():
def __init__(self):
self.MAX = 10
self.arr = [[] for i in range(self.MAX)]
def get_hash(self, key):
h = 0
for char in key:
h += ord(char)
return h % self.MAX
@beriomind
beriomind / Hash-Table.py
Last active April 18, 2026 12:15
Data Structure - Hash Table - Python implementation
def get_hash(key):
h = 0
for char in key:
h += ord(char)
return h % 100
class HashTable():
def __init__(self):
self.MAX = 100
self.arr = [None for i in range(self.MAX)]
@beriomind
beriomind / double-linked-list.py
Created April 18, 2026 10:46
Data Structure - Double Linked List - Python implementation
class Node:
def __init__(self, data=None, next=None, prev=None):
self.data = data
self.next = next
self.prev = prev
class DoublyLinkedList:
def __init__(self):
self.head = None
@beriomind
beriomind / linked-list.py
Last active April 18, 2026 10:43
Data Structure - Linked List - Python implementation
class Node:
def __init__(self, data=None, next=None):
self.data = data
self.next = next
class LinkedList:
def __init__(self):
self.head = None
def insert_at_beginning(self, data):
@beriomind
beriomind / .gitignore
Created April 17, 2026 10:22
Basic .gitignore file for python projects
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Environments
.venv/
venv/
ENV/
env/