Skip to content

Instantly share code, notes, and snippets.

@branning
branning / environment.yml
Created June 10, 2015 18:33
kind of like perl -pe, but less fun
name: channeltest
dependencies:
- pip=7.0.3=py27_0
- python=2.7.10=0
- scandir=1.1=py27_0
- setuptools=17.0=py27_0
@branning
branning / binary_trees.py
Created June 10, 2015 00:06
Binary tree algorithms
#!/usr/bin/env python
from itertools import cycle
class Node(object):
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def preorder(self, shape=False):
# open https://docs.google.com/spreadsheets/d/1k77hjQolIU3Lw6mq-d1GgbKQQpTPU6obExG5CsfI4E0
# highlight whole column, Ctrl+C
import json
src = '''
0.1833333333
0.4333333333
0.45
0.45