Skip to content

Instantly share code, notes, and snippets.

View LeslieK's full-sized avatar

LeslieK LeslieK

  • New Jersey, USA
View GitHub Profile
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def countNodes(self, root):
"""
@LeslieK
LeslieK / AnatomyofMatplotlib3
Created June 18, 2014 15:52
Notes from Anatomy of Matplotlib tutorial on youtube
{
"metadata": {
"name": "AnatomyOfMatplotlib3"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@LeslieK
LeslieK / AnatomyOfMatplotlib2
Created June 18, 2014 15:50
Notes from Anatomy Of Matplotlib 2 tutorial on youtube
{
"metadata": {
"name": "AnatomyOfMatplotlib2"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@LeslieK
LeslieK / AnatomyOfMatplotlib1
Last active August 29, 2015 14:02
Notes from Anatomy of Matplotlib 1 tutorial on youtube
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@LeslieK
LeslieK / Python33DictExperiments
Created May 2, 2014 16:41
Python33DictExperiments
{
"metadata": {
"name": "Python33DictionaryExperiments"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@LeslieK
LeslieK / CPython33Dict
Last active November 25, 2015 17:07
Routines that examine the internals of a CPython dictionary for python 3.3 (modification of Brandon Rhodes' code _dictinfo.py) (See comment at bottom.)
"""Routines that examine the internals of a CPython dictionary using python 3.3."""
from ctypes import Structure, c_ulong, POINTER, cast, py_object, CFUNCTYPE, pointer, c_ssize_t, c_void_p
#from math import log
UMAX = 2 ** 32
def cbin(n):
"""Return `n` as a clean 32-bit binary number, without a leading '0b'."""
@LeslieK
LeslieK / HashTableExperiments
Last active August 29, 2015 14:00
Plotting cost of inserting keys into a hash table using double hashing linear probe open addressing
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@LeslieK
LeslieK / Python3.3UnicodeWindowsConsole
Last active August 29, 2015 13:58
Python 3.3: Windows Console Behavior with Unicode
{
"metadata": {
"name": "Python3.3WindowsConsoleUnicode"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@LeslieK
LeslieK / RedBlackTreePlots
Created March 23, 2014 04:07
Investigating Heights: Binary Search Tree vs Red-Black Tree
{
"metadata": {
"name": "RedBlackTreesPlots"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@LeslieK
LeslieK / BinarySearchTrees
Created March 23, 2014 03:58
Binary Search Trees vs Red-Black Tree Experiments
{
"metadata": {
"name": "BinaryTrees"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{