Dasalgo Reviewer Nice
Dasalgo Reviewer Nice
DASALGO Reviewer
I. True/ False
1. A tree can have no subtrees.
2. All of the following are valid functions for queues: create(queue), queue(queue,
item), dequeue(queue)
3. If head == tail, the queue is full.
4. Children of the same parent node are called siblings.
5. Parent of a node is all the nodes along the path from the root to that node.
6. Descendants are all the nodes of the subtrees of a node.
7. A node with no children is called an empty node.
8. The height of a node is determined by the number of edges on the longest
simple downward path from the node to a leaf.
9. In a full binary tree, each node is either a leaf of has a degree of exactly 2.
10. The weight of a tree is determined by the number of leaf nodes found in it.
II. Compute for the total frequency count and its Big-Oh of the following codes:
1.
int isPalindrome(int A[], int size)
{
int i,
palindrome = 1;
return palindrome;
}
2.
void sProduct( int A[][n], int B[][n], int c)
{
int i, j;
for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
B[i][j] = c * A[i][j];
}
3.
int nPower( int a, int n)
{
if (n == 0)
return 1;
else return (a * nPower(a, n-1));
}