Quiz


1.  

What is a tree?

a tree is a data structure where data is stored in nodes. nodes are arranged in branches where each node can expand into 0, 1, or 2 other nodes.

2.  

What is the relationship between parent node and child nodes?

a parent node is a node that branches into one or two other nodes, which are called child nodes.

3.  

What are a key and a value?

a key is a component of a node that identifies the node. an application searches keys to locate a desired node. a value is also a component of a node that is used to store data.

4.  

What is a root node?

a root node is another term for a parent node.

5.  

What is the purpose of a left child node and a right child node?

the left child node has a key that is less than the key of its parent node. the right child node has a key that is greater than the key of its parent node.

6.  

What is a leaf node?

a leaf node is the last node on a branch and does not have any child nodes.

7.  

What is the depth of a tree?

the depth of a tree is the number of levels of a tree.

8.  

What is the size of a tree?

the size of a tree is the number of nodes on the tree.

9.  

How do you calculate the size of a tree?

you calculate the size of a tree by using the following formula: size 2 depth if the depth is 5 levels, then the size is 32, as shown here: 32 2 5

10.  

Can a tree have a duplicate key?

no, a tree cannot have a duplicate key.

Answers

1.  

A tree is a data structure where data is stored in nodes. Nodes are arranged in branches where each node can expand into 0, 1, or 2 other nodes.

2.  

A parent node is a node that branches into one or two other nodes, which are called child nodes.

3.  

A key is a component of a node that identifies the node. An application searches keys to locate a desired node. A value is also a component of a node that is used to store data.

4.  

A root node is another term for a parent node.

5.  

The left child node has a key that is less than the key of its parent node. The right child node has a key that is greater than the key of its parent node.

6.  

A leaf node is the last node on a branch and does not have any child nodes.

7.  

The depth of a tree is the number of levels of a tree.

8.  

The size of a tree is the number of nodes on the tree.

9.  

You calculate the size of a tree by using the following formula:

size » 2 depth

If the depth is 5 levels, then the size is 32, as shown here:

32 » 2 5

10.  

No, a tree cannot have a duplicate key.




Data Structures Demystified
Data Structures Demystified (Demystified)
ISBN: 0072253592
EAN: 2147483647
Year: 2006
Pages: 90

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net