COP 3530 Quiz 12
Run time of a graph traversal can be reduced to polynomial order by the use of a ____ as the internal traversal data structure.
Heap
The ____ of a function or operation is the number of arguments or operands that the function takes.
arity
Select all the applications of a tree data structure
- Manipulate hierarchical data - Make information easy to search - Manipulate sorted lists of data - Router algorithms
Which of the following statement(s) is TRUE? 1. A hash function takes a message of arbitrary length and generates a fixed length code. 2. A hash function takes a message of fixed length and generates a code of variable length. 3. A hash function may give the same hash value for distinct messages.
1 and 3 only
In a game you have a list of numbers - you can select one number at a time, but can only select from the outermost numbers. For example if the numbers are 5 8 4 2 - on the first round you can only select 5 or 2. In the next round your competitor can select a number, and so on. Your score is the sum of all numbers you select. Using 5 8 4 2 - you can go first, what should be the first number you select?
2
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.
233168
Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on level i of a binary tree is
2^(i-1)
If every node of a tree has 0 or 3 children; then if the tree has 4 total nodes - then how many of these are leaf nodes?
3
The maximum number of binary trees that can be formed with three unlabeled nodes is
5
If every node of a tree has 0 or 3 children; then if the tree has 13 total nodes - then how many of these are leaf nodes?
9
The value 99 will place into which slot 0-9 in a hash table using the hash function h(k) = k mod 10
9
Every full binary tree is also a complete binary tree.
False
No binary tree is both complete and full
False
If a tree satisfies the ____ property such that if P is a parent node of C, then the key value of Node P is greater than the key value of Node C. The data type is called a _____.
Heap
If arity of operators is fixed, then which of the following notations can be used to parse expressions without parentheses? a) Infix Notation (Inorder traversal of a expression tree) b) Postfix Notation (Postorder traversal of a expression tree) c) Prefix Notation (Preorder traversal of a expression tree)
b and c
According to NIST (National Institute of Standards) _______ traversal is where you process all nodes of a tree by recursively processing all subtrees, then finally process the root.
postfix