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
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
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
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
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
Homework #1
Date Assigned: Tuesday, September 13, 2016
Due Date: Tuesday, September 20, 2016
1. What is an Abstract Data Type (ADT)? Give an example of an ADT (different
from the example given in the lecture notes)
2. If
CSCI-255 Advanced Data Structures
Homework #6
Date Assigned: Friday, October 28, 2016
Due Date: Friday, November 4, 2016
1. The following items are inserted into a binary tree in the following order: 1, 3, 5, 8, 0,
9, 12, 4, 2, 15
a) Assume the binary tre
CSCI-255 Advanced Data Structures
Lab #4 Recursive Functions
October 11, 2016
Write a C+ program that implements the following recursive functions. Write each as a
separate function and a main function for testing them.
1. A recursive function that comput