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

Think about a trie we used to parse words. When we do search for a word, we need to start from the root and traverse down the tree to find each character in the word.

For a simple tree, it's the same. If I say I want to know the LARD about 'a' node vs. 'b' node in the tree, while all you have is a tree, and a reference to the root node. Then you have to go down the tree to find where 'a' or 'b' is. Retrieving pre and post values in constant time doesn't imply you already have a reference to that particular node, it's only after you find that node, that retrieving will become constant time.

It's also like I give you a URL and ask for its indegree. You have to do comparions of this URL against your graph structure, and when you see a match, you can get the indegree.

When you build a graph or a tree, there is only one node known to the user, which is where all the searches will start from. I don't think all the references to every node are available. In that case, we don't have to talk about O(f(n)) at all, because if we have references to all objects, why shall we use BST instead of a linked list?

Also, let me mention the possibility of using hashtable again. If hashtable is used, then we can quickly get the reference of an object, so find will be constant time. In all other cases, all searches shall start at the beginning of a date structure, and go through the structure to do a find.
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