Study Guides
(238,527)

Canada
(115,195)

Langara College
(46)

Computer Science
(6)

CPSC 1045
(1)

C.Clevinson
(1)

Final

# Final Exam Review.docx

Unlock Document

Langara College

Computer Science

CPSC 1045

C.Clevinson

Fall

Description

Final Exam Review
1. know binary search algorithm
2. know BigO notation (#n times an algorithm is being executed)
- for loops
- sorting
3. set up a Binary search tree {12, 8, 5, 25, 9...} left side holds the smallest value
12
8 25
5 9
4. Algorithm to insert a node into a Binary Search Tree:
1. Check if the value is greater or less than
2. Check if you can go to the left/right
3. If not, set up the node
4. If you can, insert the node and value
insert(node n, value v) {
if(v < n.value) {
if(n.left == null) n.left = v;
else
insert(n.left, v);
...
}
if(v > n.value)...
}
insert(v) {
if(root = null)
root = v;
else
insert(root, v);
}
5. Why do we use generics instead of using Object as a reference type?
A: objects might have to be casted while with generics you always know what
you are dealing with in term of type/properties
6. Making a class and methods generic?
7. Something about class Cat and Dog extending an An

More
Less
Related notes for CPSC 1045