Discussion Board
There are no previous messagesGo to the following message
Current Forum: 15-211 Main Forum
Date: Mon Dec 17 2001 5:00 pm
Author: White, David <white3@andrew.cmu.edu>
Subject: Tree Positions question on Fall 00 Test

I have a question about the LARD in trees stuff.
For problem a), two nodes, n1 != n2, exactly how many of
the relations L, A, R, D can hold between them?

I said two. But it could be four. The problem I'm having is lets say n1 is a descendent of n2, therefore n2 is a ancestor of n1 (we have two so far), now lets say n1 is off on the left subtree of n2. Is n1Ln2? and n2Rn1?

I'm trying to figure out the description from the top of the page. It reads: Node n1 is left of n2 if there is an ancestor n of both n1 and n2 such that n1 is a descendent of the left child of n and n2 is a descendent of the right child of n.
For this case, n2==n, but I think the last line disqualifies it since it says, n2 must be a descendent of the "right child" of n. If it just said it must be a descendent of n, it would work since, if n2==n it is an ancestor and a descendent, but not of its right child..

At any rate, did anyone else get 2 for this answer?

For b) I got n1An2 && n2Dn1 or n1Ln2 && n2Rn1
For c) I got n1Ln2 && n1Rn2 or n1Dn2 && n2An1
For d) n1An2: pre(n1)post(n2)
n1Rn2: pre(n1)>pre(n2) and post(n1)>post(n2)
n1Dn2: pre(n1)>pre(n2) and post(n1)For e) O(N+M).

Anyone else get similar or different answers?
Post response

There are no previous messagesGo to the following message
Current Thread Detail:
Tree Positions question on Fall 00 Test      White, David      Mon Dec 17 2001 5:00 pm       
Re: Tree Positions question on Fall...      Shi, Ying      Mon Dec 17 2001 6:13 pm       
Re: Tree Positions question on F...      White, David      Mon Dec 17 2001 8:46 pm       
Re: Tree Positions question o...      Shi, Ying      Mon Dec 17 2001 9:36 pm       
Re: Tree Positions questio...      White, David      Mon Dec 17 2001 9:48 pm       
Re: Tree Positions ques...      Shi, Ying      Mon Dec 17 2001 9:54 pm       
Re: Tree Positions q...      Liu, Limin Angela      Tue Dec 18 2001 9:54 am       
Re: Tree Position...      White, David      Tue Dec 18 2001 10:18 am       
Re: Tree Posit...      Liu, Limin Angela      Tue Dec 18 2001 10:47 am       
Re: Tree Po...      White, David      Tue Dec 18 2001 1:51 pm       
Re: Tree Position...      White, David      Tue Dec 18 2001 10:21 am       
Re: Tree Posit...      Liu, Limin Angela      Tue Dec 18 2001 10:34 am       

Back to previous screen