Re: Homework 9


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]

Posted by hussein on July 25, 1999 at 02:59:14:

In Reply to: Re: Homework 9 posted by Jared Anderson on July 25, 1999 at 02:30:23:

: : Can't we have root 2 with child 0 and child 1?

: The problem says that when two trees are of the same size, we are to make the root with the greater value be the child of the root with the lesser value.

: So for step one, since the tree with root 0 (which is just 0) and the tree with root 2 (which is just 2) are of the same size, we have to make 2 the child of 0!! Then, with (1,2), we already know 2 ~ 0, so we can just tack 1 on to the tree. Since 1's tree is smaller, we have to attach it to the root of the larger, which is 0. So 0 winds up with children 1 and 2.

: did that make sense?

sounds reasonable to me.

---

hussein


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]