p.brc

Sunday, November 27, 2016

99 Clojure Problems – 64: Binary Tree Layout (1)

›
"Given a binary tree as defined before being either a vector of the form [v l r] or nil. As a preparation for drawing the tree, a lay...
Saturday, May 28, 2016

99 Clojure Problems – 63: Construct a Complete Binary Tree

›
"A complete binary tree with height H is defined as follows: The levels 1,2,3,...,H-1 contain the maximum number of nodes (i.e 2(i-1) ...
Sunday, March 20, 2016

99 Clojure Problems – 62B: Collect the Nodes at a Given Level in a List.

›
"A node of a binary tree is at level N if the path from the root to the node has length N-1. The root node is at level 1. Write a met...
Tuesday, March 08, 2016

99 Clojure Problems – 61A: Collect the Leaves of a Binary Tree in a List

›
"61A (*) Collect the leaves of a binary tree in a list. A leaf is a node with no successors. Write a method leaves to collect them...
Wednesday, March 02, 2016

99 Clojure Problems – 62: Collect the Internal Nodes of Binary Tree in a List

›
"An internal node of a binary tree has either one or two non-empty successors. Write a method internals to collect them in a list....
Sunday, February 21, 2016

99 Clojure Problems – 61: Count the Leaves of a Binary Tree.

›
"A leaf is a node with no successors. Write a method leaf-count to count them." (deftest p61-count-leaves (is (= (leaf-count...
Wednesday, February 17, 2016

99 Clojure Problems – 60 (alternative solution): Construct Height-balanced Binary Trees with a Given Number of Nodes.

›
This post describes an alternative solution to problem 60 based on logic programming. Check out my previous post for a functional Cloj...
›
Home
View web version

About Me

pbrc
View my complete profile
Powered by Blogger.