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
name: build | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install Ruby |
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
/* | |
FixedSizeLinkedList.cs | |
UPLOADED HERE FOR DEBUGGING PURPOSE ONLY!! | |
Description: A linkedlist that has a fixed size. When the list is full, adding item removes previous item (based on eviction policy). | |
Author: Yu Long | |
Created: Saturday, February 04 2023 | |
Unity Version: 2021.3.3f1 | |
Contact: [email protected] |
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
#LLRBT implementation | |
from binary_search_tree import BSTNode | |
class LLRBNode(BSTNode): | |
def __init__(self, black: bool, key, val, left = None, right = None, parent = None) -> None: | |
self.black = black | |
self.key = key | |
self.val = val | |
self.left = left | |
self.right = right |
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 Sorting: | |
### Comparison Sorting ### | |
# Insertion sort | |
# without swapping in every step | |
# θ(n^2), but gets better if data is already somewhat sorted | |
# more precisely, θ(nk), k is the max amount of data displaced from sorted position | |
@staticmethod | |
def insertion_sort(arr, comparator): |
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
# A implementation for a string hashset | |
# using a string hash function similar to Java | |
# using a linkedlist for collision | |
# removal is not yet implemented... | |
class StringHashSet: | |
def __init__(self, | |
initial_size = 10,\ | |
resize_factor = 2,\ | |
load_limit = 5,\ |
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
#BST implementation | |
from binary_tree import BinaryTreeNode | |
class BSTNode(BinaryTreeNode): | |
def __init__(self, key, val, left = None, right = None, parent = None) -> None: | |
self.key = key | |
self.val = val | |
self.left = left |
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
#Binary Tree implementation | |
from collections import deque | |
class BinaryTreeNode: | |
def __init__(self, label, left = None, right = None) -> None: | |
self.left = left | |
self.right = right | |
self.label = label | |
def __str__(self) -> str: |
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
# A min heap implementation with array | |
# Not tested yet | |
class PriorityQueue(object): | |
# offset the index by one | |
# this way, indexing are easier | |
def __init__(self): | |
self.arr = [None] | |
def __str__(self): |
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
print("Hellow, gist!") |