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

So it must have been the formatting for
part d, I had the same thing.

For e, where we differ, my logic was as such.
It will take O(N) to do Preorder and store the
value. It will take O(N) to do Postorder and store
he value. So total setup will take O(2N)=O(N).

Then after that if you do M queries, it takes constant
time to calulate the relative positions (since it is
already calculated), so it will take O(M).
Total time is then O(M+N).

I don't see how you get O(M*N). If it finding the relative
position of the pairs took N each query it would, but since
we do that in a preprocessing step, it will only take constant
time, hence the benefit to doing this at all. Right?

Thanks
Post response

Go to the previous messageGo 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