Computer Science 2P03 Date: July 14*, 2007 Page l of 14
Brock University
Final Exam: Spring 2007 Number of Pa :
Course: COSC 2P03 Number of Students: 16
Date of Examination: July 14th, 2007 Number of Hours: 3
Location of Examination: Bob Davis Gym -

Tree Traversals reminder
Breadth-first traversal:
starting from root, visit all nodes on each level in
turn, from left to right
Depth-first traversals:
Preorder: visit root, traverse left, traverse right
General case: visit root, then traverse subtrees

Heaps
A heap is a binary tree that satisfies the following
properties:
Structure property: It is a complete binary tree
Heap-order property: Each node satisfies the
heap condition:
The key of every node must be smaller than (or equal
to) the keys of it

Representation of a Threaded Tree
class ThreadedNode
cfw_
<declarations for info stored in node, e.g.
int info;>
ThreadedNode left;
ThreadedNode right;
boolean lThread; / true if left is a thread
boolean rThread; / true if right is a thread
public void d

Representation of an AVL Node
class AVLNode
cfw_ < declarations for info stored in node,
e.g. int info; >
AVLnode left;
AVLnode right;
int height;
int height(AVLNode T)
cfw_
return T = null? -1 : T.height;
;
COSC 2P03 Week 5
1
AVL insert
AVLNode insert(A

NAME: _
STUDENT NUMBER: - - - - - -
BROCK UNIVERSITY
Final Examination:
Course:
Date of Examination:
Time of Examination:
Fall2015
COSC2P03
21st December, 2015
16:00-19:00
Number of Pages: 15
Number of students: 55
Number of Hours: 3
Instructor: S. Hought

Cosc 2P03 Fall 2014
Assignment#3
(Due date for assignment is Friday Oct. 24th 4:00 p.m., Late date Monday Oct. 27th, 4:00 p.m.)
Data Input Below.
Objective
To implement an AVL tree with deletion.
The Assignment
Implement a BST which has a String element a

Cosc 2P03 Fall 2014
Assignment#5
(Due date for assignment is Friday Nov. 28th 4:00 p.m., Late date Monday Dec. 1st, 4:00 p.m.)
Data Input Below.
Objective
To implement a double hashing scheme.
The Assignment
This assignment will allow you to implement a h

Cosc 2P03 Fall 2014
Assignment#2
(Due date for assignment is Friday Oct. 3rd 4:00 p.m., Late date Monday Oct.6th, 4:00 p.m.)
Data Input Below.
Objective
Build and traverse a Binary Search tree using several traversal methods.
The Assignment
Implement a BS

COSC 2P03 Advanced Data Structures
Fall 2016
Assignment #1
Due Date:
September 26th, noon
Late Date: September 29th, noon
This assignment accounts for 6% of your final grade and is worth a total of 60 marks
The goal of this assignment is to practice using

Stacks review
A Last-In First-Out (LIFO) structure
Basic Operations:
top
push: insert data item onto top of stack
pop: remove data item from top of stack
Additional Operations
isEmpty: determine if stack is empty
isFull: determine if stack is full

Brock University - COSC 2P03 - Advanced Data Structures - Spring Term, 2014
Instructor: Earl Foxwell
email: efoxwell@brocku.ca
Classes: Thursdays 19:00-22:00 WH207
Tutorial: Thursdays 18:00-19:00 WH207 (excluding first week)
This course teaches how to cre

The Rules of Recursion
1. There must be base cases that can be
solved without recursion
2. Recursive calls must always make
progress towards a base case
3. Assume that all recursive calls work
4. Never duplicate work by solving the
same instance of a prob

Reasons to study Data Structures &
Algorithms
Provide abstraction
Handling of real-world data storage
Programmers tools
Modeling of real-world objects and concepts
Programs more readable, understandable, maintainable
If you have a good feeling for them, y

Reasons to study Data Structures &
Algorithms
Provide abstraction
Handling of real-world data storage
Programmers tools
Modeling of real-world objects and concepts
Programs more readable, understandable, maintainable
If you have a good feeling for them, y

COSC 2P03 Assignment 1
Due: Friday May 29th at 5:00pm
This assignment deals with data structures. Specifically, you'll be providing an implementation for a defined
ADT. You'll also be reacquainting yourself with generics and packages.
MacguffinList:
The M