[program-l] representing trees

  • From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Tue, 02 Oct 2012 14:42:07 -0600

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

Other related posts: