CSCI-255 Advanced Data Structures
Homework #5
Date Assigned: Friday, October 21, 2016
Due Date: Friday, October 28, 2016
1. Draw binary search trees of height 2, 3, 4, 5, and 6 on the set of keys cfw_1, 4, 5, 10, 16,
17, 21.
2. Show the result of insertin

CSCI-255 Advanced Data Structures
Homework #7
Date Assigned: Tuesday, November 15, 2016
Due Date: Tuesday, November 22, 2016
1. Use Dijkstras algorithm to find the shortest path from A to all other vertices in the below
graph. Show all steps of the algori

CSCI-255
Advanced Data Structures
Lecture 9
Time Analysis
o Example: Consider binary searching an ordered
array to find a number
n Best Case? (done in class)
n Worst Case? (done in class)
n Average Case? (done in class)
Lists
o A list is a varying-length,

CSCI-255
Advanced Data Structures
Lecture 2
Abstract Data Type
o A type is a collection of values
n E.g., Boolean, Integer
o A data type is a type together with a collection of
operations to manipulate the type
n E.g., Integer data type
o An abstract data

CSCI-255
Advanced Data Structures
Lecture 6
Analysis of Algorithms
We can give a very concrete statement about
the running time of an algorithm on inputs of size
n such as: On any input of size n, the algorithm
runs for at most 1.62n2 + 3.5n + 8 steps
F

CSCI-255 Advanced Data Structures
Lab #7 - Practice with Binary Heaps
November 15, 2016
Implement the MakeHeap function described in the lecture slides. The function input arguments
are an integer array and its heapsize (i.e., the current number of elemen

CSCI-255 Advanced Data Structures
Homework #3
Date Assigned: Tuesday, September 27, 2016
Due Date: Tuesday, October 4, 2016
1. How many nodes does the shortest linked list have? The longest linked list?
2. A linked list does not have to be implemented wit

CSCI-255 Advanced Data Structures
Lab #3 Linked Lists
September 27, 2016
Given the following class definition for a linked list (i.e., the contents of LinkedList.h):
class Node cfw_
public:
int info;
Node* next;
Node(int el = 0, Node* ptr = 0) cfw_
info =

CSCI-255 Advanced Data Structures
Homework #4
Date Assigned: Friday, October 14, 2016
Due Date: Friday, October 21, 2016
1. Write (in pseudocode) a recursive algorithm (no loops allowed) that calculates
and returns the length of a linked list.
2. Write (i

CSCI-255 Advanced Data Structures
Lab #5 Binary Search Trees
October 25, 2016
Given the following header file BST.h that defines a simple Binary Search Tree of
integers, write a BST.cpp file that contains the implementation of functions insert
and count.

CSCI-255 Advanced Data Structures
Lab #2 Time Complexity Analysis
September 20, 2016
In this lab you will examine the time performance of two search algorithms: sequential search
and binary search. The two algorithms have been implemented as functions
seq

CSCI255 Advanced Data Structures
Lab #1 - C+ Templates
September 13, 2016
Create a template class called Pair that represents a pair of things. Provide a constructor
that enables an object of this class to be initialized when it is declared. Provide a pub

CSCI-255
Advanced Data Structures
Lecture 10
How to Implement a List
o Option 1
n Use a built-in array stored in contiguous memory
locations, implementing operations Insert and Delete
by moving list items around in the array, as needed
o Option 2
n Use a

CSCI-255
Advanced Data Structures
Lecture 5
Analysis of Algorithms
o The same problem can frequently be solved with
algorithms that differ in efficiency
o How to measure and compare the efficiency of
algorithms?
Some Initial Attempts at Defining Efficienc

CSCI-255 Advanced Data Structures
Lab #9 Sorting Algorithms
November 29, 2016
Implement the insertionSort, selectionSort, and bubbleSort integer array sorting
algorithms as described in the lecture slides. Write each as a separate function and a main
func

CSCI-255 Advanced Data Structures
Homework #2
Date Assigned: Tuesday, September 20, 2016
Due Date: Tuesday, September 27, 2016
1. For the following pseudocode fragment, give an analysis of the time complexity
(Big-Oh will do but justify your answer)
Sum 0

CSCI-255
Advanced Data Structures
Lecture 8
Time Analysis
o Since the time it takes to execute an algorithm
usually depends on the size of the input, we
express the algorithm's time complexity as a
function of the size of the input
o But sometimes, inputs

CSCI-255
Advanced Data Structures
Lecture 3
Templates
o A powerful C+s software reuse feature
o Templates enable programmers to specify, with a
single code segment
n an entire range of related (overloaded) functions
called function-template specializatio

CSCI-255
Advanced Data Structures Lecture 25
Graphs
How would you represent the following?
A chart of driving distances between cities in Canada A network The prerequisite relationship between CS classes
These problems have similar structure:
A collection

CSCI-255
Advanced Data Structures Lecture 24
Recap: Time Complexity of Basic AVL Tree Operations
Insert
Maximum possible number of rotations = 1
Delete
Maximum possible number of rotations = lg(n)
Worst case times
Search: O(lgn) Insert: O(lgn) Delete: O(l

CSCI-255
Advanced Data Structures Lecture 23
AVL Trees: Insert (contd)
1. 2. Insert the node as in a BST Starting at the newly inserted node, travel up the tree (towards the root), updating the balances along the way
The first node for which the balance f

CSCI-255
Advanced Data Structures Lecture 22
Recap from Last Lecture
Asymptotic time complexity of basic BST operations (i.e., Search, Insert, Delete) is O(h) where h is the height of the tree
BSTs are limited because of their bad worst-case performance O