private static void writeTrie(Node x) {
		if (x.isLeaf()) {
			BinaryStdOut.write(true);    // leaf
			BinaryStdOut.write(x.ch, 8); // print char
			return;
		}
		
		// pre-order traversal
		BinaryStdOut.write(false); // internal node
		writeTrie(x.left);
		writeTrie(x.right);
	}