CMPT 307 Data Structures and Algorithms Exercises on Median and Order Statistics. Due: Thursday, October 15th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collab
Problem: Median Finding Algorithm for Joint Databases
You are interested in analyzing some hard to obtain data from two separate databases. Each database contains n numerical values - so there are 2n
CMPT 307 Last Name
This is a sample!
First Name and Initials
Midterm Test
Some Day, 2009
Student No. NO AIDS allowed. Answer ALL questions on the test paper. Use backs of sheets for scratch work. Tota
CMPT 307 Data Structures and Algorithms Exercises on Divide and Conquer. Due: Thursday, November 19th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collaboration
Chapter 1
Introduction: Some Representative Problems
1.1 A First Problem: Stable Matching
As an opening topic, we look at an algorithmic problem that nicely illustrates many of the themes we will be e
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Elementary Data Structures
1. Suggest how storage for elements can be allocated and deallocated within the hash table itself b
CMPT 307 Data Structures and Algorithms Exercises on Sorting. Due: Thursday, October 8th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collaboration and consultin
CMPT 307 Data Structures and Algorithms Exercises on Elementary Data Structures. Due: Thursday, October 22th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collabo
CMPT 307 Data Structures and Algorithms Exercises on Heaps and Stable Matchings. Due: Thursday, September 24th (at the beginning of the class)
Reminder: the work you submit must be your own. Any colla
CMPT 307 Data Structures and Algorithms Exercises on Red-Black Trees. Due: Thursday, November 5th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collaboration and
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Heaps and Stable Matchings
1. Describe a (n log n) time algorithm that, given a set S of n integers and another integer x, det
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Sorting
1. Show that the worst-case running time of Heapify-Up on a heap of size n is (log n). If the new value added to the v
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Sorting
1. Show that the second smallest of n elements can be found with n + log n 2 comparisons in the worst case. The smalle
CMPT 307 Data Structures and Algorithms Outline Solutions to Exercises on Red-Black Trees
1. Show that any arbitrary n-node binary search tree can be transformed into any other arbitrary n-node binary
More Heaps
Data Structures and Algorithms Andrei Bulatov
Algorithms More Heaps
22-2
Binomial Heap: Union
Create heap H that is union of heaps H and H'. "Mergeable heaps." Easy if H and H' are each ord
Massachusetts Institute of Technology 6.046J/18.410J: Introduction to Algorithms Professors Piotr Indyk and Bruce Tidor
Handout 9 February 27, 2003
Problem Set 2 Solutions
Problem 2-1.
Matching Nuts a
Problem 1 A heap of size n has at most n/2h+1 nodes with height h. Proof : Property 1: Let Sh be the set of nodes of height h, subtrees rooted at nodes in Sh are disjoint. In other words, we cannot ha
CMPT 307 - Data Structures and Algorithms:
Problem Set 3
1. Recurrences Give asymptotic upper and lower bounds for T (n) in each of the following recurrences. Assume that T (n) is constant for n 2. Ma
Sequence Alignment
Data Structures and Algorithms Andrei Bulatov
Algorithms Sequence Alignment
20-2
Shortest Path: Finding Negative Cycles
Two questions: - how to decide if there is a negative cycle?
Binomial Heaps
Data Structures and Algorithms Andrei Bulatov
Algorithms Binomial Heaps
21-2
Priority Queues
Supports the following operations. Insert element x. Return min element. Return and delete
Heapsort
Data Structures and Algorithms Andrei Bulatov
Algorithms Heapsort
4-2
Heap Property
A heap is a nearly complete binary tree, satisfying an extra condition Let Parent(i) denote the parent of t
QuickSort and Others
Data Structures and Algorithms Andrei Bulatov
Algorithms Quicksort
5-2
Heap Property
A heap is a nearly complete binary tree, satisfying an extra condition Let Parent(i) denote th
QuickSort
Data Structures and Algorithms Andrei Bulatov
Algorithms Quicksort
6-2
Probability Reminder
Sample space Event Probability Discrete random variable: A variable that takes values with certain
Sorting in Linear Time
Data Structures and Algorithms Andrei Bulatov
Algorithms Sorting in Linear Time
7-2
Comparison Sorts
The only test that all the algorithms we have considered so far is compariso
Order Statistics
Data Structures and Algorithms Andrei Bulatov
Algorithms Order Statistics
8-2
Medians and Statistics
We consider the following problems: - Find a minimal and maximal elements in a seq
Queues, Stacks, Graph Traversing
Data Structures and Algorithms Andrei Bulatov
Algorithms Queues, Stacks, Graph Traversing
9-2
Graph Reminder
Vertices and edges Nodes and arcs Representation of graphs
Hash Tables
Data Structures and Algorithms Andrei Bulatov
Algorithms Hash Tables
10-2
The Dictionary Problem
We have a dictionary Each entry of the dictionary consists of a key, a word, and an article
Hash Tables II
Data Structures and Algorithms Andrei Bulatov
Algorithms Hash Tables II
11-2
Hash Tables
In case of collision create a list of elements with the same hash value
h(k1 ) k1
k2 k4
key arti
Binary Search Trees
Data Structures and Algorithms Andrei Bulatov
Algorithms Binary Search Trees
12-2
Binary Search Tree
A binary search tree is a binary rooted tree, in which keys satisfy the Binary