Discussion Board
Go to the previous messageGo to the following message
Current Forum: 15-211 Main Forum
Date: Tue Dec 18 2001 9:54 am
Author: Liu, Limin Angela <laliu@andrew.cmu.edu>
Subject: Re: Tree Positions question on Fall 00 Test

I think O(MN) is correct. Aditya mentioned that unless it specifically says that it's a binary search tree (find in O(lgN) time), assume it's just a linked list. So every find needs O(N) time. Because we don't know where every node is. Unless we use hashtable to match each node to a key value, then the find will be constant time. Since we need to do 2M find, we need O(MN) totally.

e.g. there are many letters stored in the tree, each node is one letter. We want to know the LARD relationship between 'a' and 'b'. We first need to find where 'a' is stored in the tree, then retrieve its pre and post value.

Any comments?
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