[program-l] Re: representing trees

  • From: Soronel Haetir <soronel.haetir@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Tue, 2 Oct 2012 15:03:20 -0800

I would generally have the easiest time dealing with it in actual tree form

   D
 B   F
A C E G

And then if B were removed it might become:
   D
 A   F
 C E G

Far easier for me to build up a mental picture of the links this way
rather than from a textual description of the tree, if I were given a
text description of the tree I would have to fill out something like
the above anyway just to make sense of it, so why not skip the middle
step?

On 10/2/12, Littlefield, Tyler <tyler@xxxxxxxxxxxxx> wrote:
> Hello:
> My cs3 teacher loves giving "paper assignments" where he hands out a
> tree and tells you to remove the node whose value is 32, then redraw the
> tree.
> I'm curious how to model something like this? his idea was:
> a's value is 20
> a's left child is b
> b's value is 20
> a's right child is c
> c's value is 50
> but following things all the way to the left is a huge mess, and that's
> not even considering a rotation.
>
> --
> Take care,
> Ty
> http://tds-solutions.net
> The aspen project: a barebones light-weight mud engine:
> http://code.google.com/p/aspenmud
> He that will not reason is a bigot; he that cannot reason is a fool; he that
> dares not reason is a slave.
>
> ** To leave the list, click on the immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
> ** If this link doesn't work then send a message to:
> ** program-l-request@xxxxxxxxxxxxx
> ** and in the Subject line type
> ** unsubscribe
> ** For other list commands such as vacation mode, click on the
> ** immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
> ** or send a message, to
> ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
>


-- 
Soronel Haetir
soronel.haetir@xxxxxxxxx
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: