Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am cjrieck on github.
* I am cjrieck (https://keybase.io/cjrieck) on keybase.
* I have a public key ASAnFj48c5Qmrn4T-CmbM3QFgrMsNuJnBWiruRSlOTs8rwo
To claim this, I am signing this object:

#Interview Question

You are given a Trie (a tree in which each Node contains a character of a word inserted into it) populated with n words. The class definitions of the Node and Trie classes are as follows:

Node:

class Node:
	def __init__(self, cargo, end=False):
@cjrieck
cjrieck / mergesort.py
Created December 9, 2013 14:34
Merge sort implementation in Python
def merge_sort(aList):
if len(aList) < 2:
return aList
else:
middle = len(aList)/2
left = aList[:middle]
right = aList[middle:]
left = merge_sort(left)
@cjrieck
cjrieck / tree-orders.py
Created November 11, 2013 15:18
Python tree traversals - inorder, preorder, postorder
def inorder(node):
if node.left != None:
inorder(node.left)
print node.cargo
if node.right != None:
inorder(node.right)