Skip to content

Instantly share code, notes, and snippets.

View swang225's full-sized avatar

Shuo Wang swang225

View GitHub Profile
@swang225
swang225 / kalman_filter.py
Last active July 15, 2024 23:40
Kalman Filter
import numpy as np
import pandas as pd
# dropping tennis ball
def problem1():
dt = 1
F = np.matrix([[1, dt, 0],
@swang225
swang225 / tarjan_offline_lca
Last active November 18, 2020 03:39
Tarjan's Offline Lowest Common Ancestor Algorithm
class SetNode:
"""disjoint set node"""
def __init__(self, value):
self.__value = value
self.__parent = self
self.__ancestor = self
self.__size = 1
def __merge_in(self, other):
@swang225
swang225 / disjoint_set
Last active November 18, 2020 04:03
An implementation of disjoint set with path compression and union by size.
class SetNode:
"""disjoint set node"""
def __init__(self, value):
self.__value = value
self.__parent = self
self.__size = 1
def __merge_in(self, other):
new_size = self.parent.__size + \
@swang225
swang225 / test003_coronavirus.ipynb
Created September 29, 2020 06:25
NYC Coronavirus Data as of 2020-02-28
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.