0% found this document useful (0 votes)
43 views3 pages

Dasalgo Reviewer Nice

DGFD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views3 pages

Dasalgo Reviewer Nice

DGFD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

lOMoARcPSD|16717824

[ Dasalgo] Reviewer - nice

Physical Fitness and Wellness in Dance (De La Salle University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Sarah Nicole Jacones Barsubia ([email protected])
lOMoARcPSD|16717824

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;

for(i = 0; i < size; i++)


if(A[i] != A[size-i-1])
palindrome = 0;

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];
}

Downloaded by Sarah Nicole Jacones Barsubia ([email protected])


lOMoARcPSD|16717824

3.
int nPower( int a, int n)
{
if (n == 0)
return 1;
else return (a * nPower(a, n-1));
}

III. Convert the following:


1. Given: (A+B) * C – D * F + C
a. Prefix
b. Postfix
2. Given: AB * C – D +
a. Infix
3. Given: +-*ABCD
a. Infix
4. (A – 2 * (B + C) – D * E) * F
a. Prefix
b. Postfix

IV. Draw the given traversal’s corresponding tree.


1. Inorder: 3, 4, 5, 6, 7, 8, 9, 11, 14, 16, 17, 22,25, 27, 40
2. Postorder: 7, 5, 2, 1, 3, 4, 10, 9, 20, 12, 18, 25, 30, 32, 35
3. Preorder: 1, 2, 3, 4, 5, 6, 12, 14, 27, 19, 11, 13, 7, 31, 35

V. Given the tree below, determine its BFS and DFS

Downloaded by Sarah Nicole Jacones Barsubia ([email protected])

You might also like