what if we assume that it's a complete binary tree with height
10(2^10-1 = 1023) ??

On Jun 22, 3:05 pm, Tundebabzy <tundeba...@gmail.com> wrote:
> Thanks so much Wladmir. This algorithm will assume that the second
> character in the string will be the root of the binary tree which
> could be misleading. The root might be the last character in the
> string. The only thing that seems to be universally correct is that
> the first character in the string is a leaf in the binary tree.
>
> I thought of extracting all the numbers in the string. If i remember
> right, they are 136 in number. Since we are talking of the sum, it
> means that we don't have to bother about which side of the tree the
> digits in the leaves are since 2L + 3R = 5 and 3L + 2R = 5. But then
> again, I got to the question begging for an answer, which exactly in
> these numbers are in the leaves of the binary tree. I could brute
> force a calculation starting by assuming that all the digits are in
> the leaves and then eliminating some of the numbers but that will
> hardly be elegant and could just be called plain cheating even though
> the site does not penalize for getting an answer wrong.
>
> On Jun 22, 2:49 am, Wladimir Tavares <wladimir...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I thought of a brute force approach but did not work.
>
> > For each character, I tested two possibilities:
> > 1. Being a leaf (the leftmost node) and the next character  is the root of a
> > subtree.
> > 2. Be the root of a subtree.
>
> > After testing all possible sums!
>
> > Wladimir Araujo Tavares
> > *Federal University of Ceará
>
> > *
>
> > On Tue, Jun 21, 2011 at 10:55 AM, Tundebabzy <tundeba...@gmail.com> wrote:
> > > Hi guys,
> > > Can anyone help me solve this (I mean explain to me how to solve it):
>
> > > The following text is an in-order traversal of a binary tree with 1023
> > > nodes. What is the sum of the digits appearing in the leaves?
>
> > > bDq4i3eFNmjh2oMgjNsIFkRWsonRl=tz9kf8gOpED2gVQrfx49GjR9/
> > > QNqTEJkSzM30p4RfneDc7EmdusIYdxxZ8KKdND==YpLlmN/FkErS7uqVHYIyGEBIhIRX
> > > +mbg6FjVGqfYjobX3F1lSmPpLXXxhux1lV=EzIgGct9pd=ogzAdJU4/
> > > yZOj9=njfvbSo11bcE/yUDHg/J=6DAtmWt+P/VDvE4GyYHlKVGUoksn
> > > +Lzm6Y1VVF6qw=onnKZS=CQQUPeMlUGtMobJEeyIyGBMFj5kHml1waI97qgVt/
> > > yeKWSXxhJyK+As0M0UR2KL+U7klKMlWlxgbIJ2beN0gaMHbIClKrBuroo
>
> > > +L73CwnbFKRiyKOx8Ke=PPukm1BWYd4Do5nikrT0dgPWlmItCzyZrEiOBgBtEB9FG1qdQJud182
> > >  qYU4Xwry=bR7R5PH=Npab7JQ7gY=MYHW24iw=m2+XayIachr=QVt4giclLluUEu3Dx/
> > > 5y7R0GlINqoJc9O6QwEP6a9PRsdt86nZYQUF/
> > > b729lzilkM1PB8mDPACTOGobXSJJQshRQCoJoC9TX6ERou/
>
> > > tlMWNQTaaU0YmzIFh8t72lgOeIMu4W2S9V8Y5jO8T47ZPRGxeQDWRQlpx1tc3AC4+x2zJxZaYV6
> > >  d4+rxxWgYnYC1ZwUvXNF2YLaRw7ldRXCz9/7xZ3mKBj4Ox51L3PqGXAIB
>
> > > +OI4pgkUc1X52tOPdRPgpsfi8wNpynfylwjITvNKq93iViQiyiEVGBgazbHQ7boh5tejStBE1SC
> > >  k1fMe1=ycNoxJzhAH4x/
> > > YlQSUOz/2qkl+JxFBt8sqRYXZjZ6R=Gh87ZwS4B0Meo56/WF+40bf2mTgG05KQ/
> > > qR89NMyttHdwwnzvkZuXGrlt/yuStJaXJNkqQ5atDPWqLJy4Q9iylEdI3qmTe6Wmou/
> > > umQG7Q
>
> > > +aiOXorJde3Z4CzMyTYnCWvudFDZvgEZsuKRiSOurstnxFRlqVQ0LC7WRuS=qCsDcxoDT5dl9NH
> > >  usV4kZ/
>
> > > I came across this @www.readyforzero.com/challenge(problem2)
>
> > > Please help me, I'm already tearing my hair out and i'm already
> > > getting bald. I'm stuck because I don't know how it is possible to
> > > figure out a tree from just its in-order traversal
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to algogeeks@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > algogeeks+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to