This file contains 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
#TODO: insert, delete | |
class Node(object): | |
def __init__(self, data): | |
self.data = data | |
self.left = None | |
self.right = None | |
def depth(root, depth=0): | |
if root.left: |
This file contains 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
#TODO: bidirectional bfs/dfs, | |
directedGraph = {0: [1,4], 1: [3], 2: [], 3: [0,1,4], 4: [0,3]} | |
undirectedGraph = {0: [1,4], 1: [0,3], 2: [], 3: [1,4], 4: [0,3]} | |
completeGraph = {0:[1,2,3], 1:[0,2,3], 2:[0,1,3], 3:[0,1,2]} | |
def bfs(graph, start, path=[]): | |
queue = [start] | |
while queue: | |
visited = queue.pop(0) | |
if visited not in path: |
This file contains 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
$ git clone A | |
$ git clone B | |
$ cd A | |
$ git remote add B ../B | |
$ git fetch B | |
$ git branch B-master B/master | |
$ git merge B-master |
This file contains 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
def closest_and_farthest(data): | |
""" | |
Finds closest and farthest apartments from a set of data | |
:param data: a pandas dataframe of the data | |
:returns: apartment ids and rounded off distances | |
""" | |
def calc_dist(lat_long_1, lat_long_2): | |
""" | |
Calculates distance(mi) between two latitude-longitude pairs |