Preview

ICS 241 Exam 2

Satisfactory Essays
Open Document
Open Document
695 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
ICS 241 Exam 2
ICS-241
M. Bauer
Exam Two
1. Create a binary search tree from the following data which is as balanced as possible.
No leaf node should be more than +/-1 level from any other leaf node. Note: Do not just create a tree from the data encountered in the following order. 78.2, -35.1, 48.2, 12.9,
-14.7, -86.1, 17.4, 92.7, 38.4, -2.8

17.4

-35.1

-86.1

48.2

-14.7

12.9

38.4

-2.8

78.2

92.7

A
B

C

D
G

E
H

I
L

M

J
N

2. Perform a postorder traversal of the tree depicted above.




Traverse its left subtree.
Traverse is right subtree.
Visit the root of the tree.



G, L, H, D, B, M, N, I, E, O, J, P, K, F, C, A

3. Evaluate the following prefix notation expression:
* - * 3 5 8 - + 4 6 3
1. 4 + 6 = 10
*

-

*

3

5

8

- 10 3

5

8

7

2. 10 – 3 = 7
*

-

*

3

3. 3 * 5 = 15
* -

15 8 7

4. 15 – 8 = 7
* 7 7
5. 7 * 7 = 49
The result is 49.

F
K
O P

4. Find a minimum spanning tree in the graph.
2
3

5

4

1
2

4

4
3

3
5

6

3

4
2

5
5. Find a Huffman code to store the string, HALEAKALA.
The word “HALEAKALA” is encoded:
• 0101000011100110001
1. List each symbol in the string and the number of times it occurs.
H = 1, A = 4, L = 2, E = 1, K = 1
2. Calculate the total number of symbols in the string uses the probability that dividing the number of times the symbol uses each symbol.
(ie. H = 1, Total# = 9, 1/9 = .11)
0.11 0.11 0.11 0.22 0.44
*H
*E
*K
*L
*A
3. Create a forest consisting of single node trees, each of which has a weight (the probability the symbol is used).
.44

.33

.22

.22

A

.11

L

K

0

L

1

1

H

E

The word “HALEAKALA” is encoded:
• 0101000011100110001

A

0

K

.11

1

0

0

.11

4. Combine the two trees having the least weight in your forest, to create a forest of (n-1) trees. Put the tree with the larger weight in the left subtree of the

You May Also Find These Documents Helpful

  • Good Essays

    Grady and Monroe are each paid a weekly salary allowance of $950. The doll shop is located in a state that requires unemployment compensation contributions of employers of one or more individuals. The company is subject to state contributions at a rate of 3.1% for wages not in excess of $8,100. Compute each of the following amounts based upon the 41st weekly payroll period for the week ending October 19, 2010:…

    • 541 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Ecs1260 Final Exam

    • 402 Words
    • 2 Pages

    4) Which of the following is not one of the main goals of monetary policy?…

    • 402 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Agec 424 Final Exam

    • 2763 Words
    • 12 Pages

    You must show logically correct work, including calculator inputs and outputs for all problems to receive credit. Show signs on calculator inputs. Differentiate calculator outputs from inputs.…

    • 2763 Words
    • 12 Pages
    Satisfactory Essays
  • Good Essays

    Astr 100 Exam 2

    • 822 Words
    • 4 Pages

    * nearly all the moons in the solar system, including Earth’s moon, orbit around their planets counterclockwise…

    • 822 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Phi227 Exam Review 02

    • 892 Words
    • 4 Pages

    1. In the paternalistic model of doctor-patient relationship, power resident exclusively with Doctors; in the engineering model, it resides entirely with Patients.…

    • 892 Words
    • 4 Pages
    Satisfactory Essays
  • Powerful Essays

    Cen 254 Data Structure

    • 924 Words
    • 4 Pages

    keys 30, 40, 24, 58, 48, 26, 11, 13 (in this order). Draw the tree after each…

    • 924 Words
    • 4 Pages
    Powerful Essays
  • Satisfactory Essays

    C200 Exam Question

    • 316 Words
    • 2 Pages

    The National Defense Strategy counterbalances the DoD’s tendency to focus on conventional conflicts by focusing on the importance of irregular warfare. The concepts of working with allies and expanding our warfare research are both focused towards irregular warfare. Additionally, studying insurgency operations and placing less emphasis on conventional tactics further emphasizes irregular warfare. The National Defense Strategy understood the need to transition from conventional to irregular war tactics.…

    • 316 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    c) Given the following(10,30,74,63,2,65,5,21,97,64) construct a binary search tree. Values inserted in the tree in the order given.…

    • 606 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Avl Tree

    • 324 Words
    • 2 Pages

    //NAME: MANGUERRA JR, WILLIAM E. //INSTRUCTOR: RUBY GLIPONEO //YEAR AND SECTION: II-CpE 1 # include # include # include using namespace std; struct node { int element; node *left;…

    • 324 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Assembly Line Balancing

    • 1083 Words
    • 5 Pages

    2 A 1 B 1 G 1.4 H C 3.25 D 1.2 E .5 F 1…

    • 1083 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    This information can be visually presented with a stem and leaf plot. A position has been chosen to break the numbers into a stem and a leaf. The leaf will always be one digit. The stems are listed on the left, and the corresponding leaves (if any) on the right. Visually a stem-and leaf plot looks like a bar chart; the categories are defined by the decimal structure of the numbers. A stem-and leaf plot for the above data is presented below:…

    • 290 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Tree Balancing

    • 3117 Words
    • 389 Pages

    L09 Tree Balancing CX1007 Data Structures 2013/14 S2 Mark Yong Today • Importance of balance for BSTs • Balancing operaGons in self-­‐balancing BSTs • Pseudocode + worked examples CX1007 Data Structures 2013/14 S2 2 Recall: Why use BSTs? • BSTs are a special form of BT L •…

    • 3117 Words
    • 389 Pages
    Satisfactory Essays
  • Good Essays

    A Red

    • 767 Words
    • 4 Pages

    The red–black tree is then structurally equivalent to a B-tree of order 4, with a minimum fill factor of 33% of values per cluster with a maximum capacity of 3 values.…

    • 767 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Array Representation

    • 338 Words
    • 2 Pages

    Figure 1: Binary tree and array representation for the MaxHeap containing elements (that has the priorities) [16,14,10,8,7,9,3,2,4,1].…

    • 338 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Tree and graphs

    • 815 Words
    • 4 Pages

    0 1 2 3 4 5 6 7 8 9 10 11 13 14 15…

    • 815 Words
    • 4 Pages
    Good Essays

Related Topics