This solution will be quite slow for large N (which is height of the tree).
Even more, you don't have to build and/or traverse a tree to solve this
problem at all.
Hint: number of nodes in full binary tree of height k is 2^{k+1} - 1.On Tue, Feb 2, 2016 at 8:40 PM, Frank Castellucci <[email protected]> wrote: > > On SO: > http://stackoverflow.com/questions/35136560/counting-nodes-in-two-different-subtrees-in-clojure > > > On Monday, February 1, 2016 at 1:16:31 PM UTC-5, xCaM wrote: >> >> Hi >> >> Im trying to write the functions for this probem >> >> https://uva.onlinejudge.org/external/116/11615.pdf >> >> as i'm new to clojure i have very very limited knowledge of the language >> and if someone could help me i'd be so grateful >> >> Cam >> > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
