From 9eab369faedd7ad6c215968d7104c3f48a3efe44 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com>
Date: Fri, 17 Sep 2010 01:32:21 +0530
Subject: [PATCH] solution to 2.71

---
 src/sicp/ex2_71.rkt | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 src/sicp/ex2_71.rkt

diff --git a/src/sicp/ex2_71.rkt b/src/sicp/ex2_71.rkt
new file mode 100644
index 0000000..d33eba4
--- /dev/null
+++ b/src/sicp/ex2_71.rkt
@@ -0,0 +1,30 @@
+#lang racket
+
+(require "ex2_69.rkt")
+
+(define (range min max (step 1))
+  (if (>= min max)
+      '()
+      (cons min (range (+ min step) max step))))
+
+;; n = 5
+(define tree5 (for/list ((x (range 0 5))
+                         (a '(A B C D E)))
+                (list a (expt 2 x))))
+
+(generate-huffman-tree tree5)
+#|
+Most frequently used symbol is E and has the code 1
+Least frequently used symbol is A and has the code 0000
+|#
+
+;; n = 10
+(define tree10 (for/list ((x (range 0 10))
+                          (a '(A B C D E F G H I J)))
+                 (list a (expt 2 x))))
+
+(generate-huffman-tree tree10)
+#|
+A - 000000000
+J - 1
+|#
\ No newline at end of file
-- 
2.45.2