FIT1002 Computer Programming
Module 11 Combining Multiple Classes: Worked Examples
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part
Trees Drills:
1. Insert the following integers into:
62 34 59 21 42 47 92
21 22 50 83 23 39 32
32 12 92 39 29 76 43
a.
b.
c.
d.
A binary search tree.
A 2 3 tree
A 2 4 tree
A Red Black tree.
For each tree note its height, number of leaves, number of intern
1. Find a maximum flow and a minimum cut in the following network:
A
B
S
T
C
D
The capacities of each edge are as follows:
SA: 3
S C: 7
AB: 5
AD: 4
AC: 2
BD: 2
BT: 8
CB: 1
CD: 4
DT: 3
ALGORITHM (FORD-FULKERSON)
SCAN THE VERTICES STARTING FROM S.
LABEL(S)
The following is an example of a run of the Red Black tree program.
The first group shows the numbers that were inserted. The second is the inorder traversal
(including the color of each node, 1 is black, 0 is red) and the third group is the postorder
tra
Definition: A tree is a connected graph with no cycles.
Observations:
1. A finite tree must contain vertices of degree 1.
Proof: Let G be a graph with all vertices of degree 2. Start with a vertex and exit along
an edge incident with it. In the next verte
Multi-Way search Trees
1. 2-3 Trees:
a. Nodes may contain 1 or 2 items.
b. A node with k items has k + 1 children
c. All leaves are on same level.
Example
A 2-3 tree storing 18 items.
20 80
30 70
5
2 4
10
25
40 50 75
90 100
85
95 110 120
Updating
Insert
Rooted
Rooted Trees
Trees
More
More definitions
definitions
root
internal vertex
descendants of g
ancestor of d
leaf
parent of d
child of c
subtree
sibling of d
Definition
Definition 2.
2.A
Arooted
rooted tree
tree isis called
called an
an m-ary
m-ary tre
The sorting game.
Observations:
For any sorting algorithm the following two
instances are equivalent:
928 205 714 693 332
8
3
7
6
5
13 227 128
1
4
2
The red instance is an 8-permutation. If the input
size is n, it is equivalent to an n-permutation.
The so
Ofﬁce Use Oniy
Monash University
Semester One Examination Period 2010
Faculty Of Information Technology
EXAM CODES: FIT1003
TITLE OF PAPER: IT IN ORGANISATIONS - PAPER 1
EXAM DURATION: 3 hours writing time
READING TIME: 10 minutes
THIS PAPER IS F OR STUDE
Graphs Drill:
In the java demos folder please find a program called Graphs.java (and its class). Copy it
to your disk. This program generates Simple Graphs, Simple DiGraphs, Weighted Simple
Graphs and assignment matrices. Note that in the weighted graphs
FIT1002 Computer Programming 2010
FIT1002 Computer Programming Semester 1, 2010
Module 1 Unit Overview and Introduction to Java
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on
FIT1002 Computer Programming
Exam Tips
FIT1002 Computer Programming
What to expect The exams are designed to test your understanding
Module 13 Revision
of the material we have covered in the lectures, the tutorials, and laboratories The sample exams can g
FIT1002 Computer Programming
FIT1002 Computer Programming
Module 10 Arrays
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of t
FIT1002 Computer Programming 2009
FIT1002 Computer Programming
Module 9 - Object References
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuan
FIT1002 Computer Programming
FIT1002 Computer Programming
Module 8 Methods Revisited
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Pa
FIT1002 Computer Programming
FIT1002 Computer Programming
Module 7 Classes & Objects
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Pa
FIT1002 Computer Programming 2010
FIT1002 Computer Programming Semester 1, 2010
Module 6 Modularisation
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash Univer
FIT1002 Computer Programming 2010
FIT1002 Computer Programming Semester 1, 2010
Module 5 Repetition
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University
FIT1002 Computer Programming 2010
FIT1002 Computer Programming Semester 1, 2010
Module 4 Selection
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University
FIT1002 Computer Programming 2010
FIT1002 Computer Programming Semester 1, 2010
Module 3 Introduction to Objects, Classes and I/O
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or
FIT1002 Computer Programming 2010
FIT1002 Computer Programming Semester 1, 2010
Module 2 Part 1 Algorithms and Data
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of M
Ofﬁce Usc Only
Monash University
Semester 1 Examination Period
2010
Faculty of Information Technology
EXAM CODES: FIT1002
TITLE OF PAPER: Computer Programming
EXAM DURATION: 3 hours writing time
READING TIME: 10 minutes
THIS PAPER IS FOR STUDENTS STUDYING